1 node > 50 Bytes,
50*1000,000 B/1024 = 50000M

解决方案 »

  1.   

    sorry, my calculation is wrong.
      

  2.   

    System.out.println("Max:\t"Runtime.getRuntime().maxMemory()/1024/1024);
    System.out.println("total:\t"+Runtime.getRuntime().totalMemory()/1024/1024);
    System.out.println("Free:\t"+Runtime.getRuntime().freeMemory()/1024/1024);
      

  3.   

    Max memory 66M, died when have 173483 nodes, 
    each node take me 1224Bytes (finish one for-loop)
      

  4.   

    你的估计值保守了。
    对于1个node对象实例,仅neib,refrom,child三个属性就要占用60个字节。
    但总体不会超过350m。
    你应用 -Xmx350m 或 -Xmx400m,这样可以通过。