out of memory - How do I solve OutOfMemoryError: Java heap space -
i getting following error on commented line:
"outofmemoryerror: java heap space"
the data.bin file huge error expected. question how around error? have seen stuff -xmx1024m or similar, don't know how run using jgrasp compiler
try { randomaccessfile data = new randomaccessfile("data.bin","rws"); long l = data.length(); long recs = l / 1024; long cnt = 0; byte []b = new byte[1024]; while(cnt < recs){ cnt++; data.readfully(b); byte []key = arrays.copyofrange(b, 0, 24); byte []value = arrays.copyofrange(b, 24, 1024); en = new tentry<string, string>(new string(key), new string(value));//error lst.add(en); }
you can increase heap/stack size using following commands:
-xms<size> set initial java heap size -xmx<size> set maximum java heap size -xss<size> set java thread stack size
you can find more descriptive answers on here.
Comments
Post a Comment