Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory in Eclipse

I'm getting the java.lang.OutOfMemoryError exception in Eclipse. I know that Eclipse by default uses heap size of 256M. I'm trying to increase it but nothing happens.

For example: eclipse -vmargs -Xmx16g -XX:PermSize=2g -XX:MaxPermSize=2g

I also tried different settings, using only the -Xmx option, using different cases of g, G, m, M, different memory sizes, but nothing helps. Tried also to specify the values in the eclipse.ini file. Does not matter which params I specify, the heap exception is thrown at the same time, so I assume there's something I'm doing wrong that Eclipse ignores the -Xmx parameter. I'm using a 32GB RAM machine and trying to execute something very simple such as:

double[][] a = new double[15000][15000];

It only works when I reduce the array size to something around 10000 on 10000.

I'm working on Linux and using the top command I can see how much memory the Java process is consuming; it's less than 2%.

Thanks!

like image 643
user247866 Avatar asked Dec 06 '25 04:12

user247866


1 Answers

Okay, I found a solution after reading Why does heap space run out only when running JUnit tests?

When I specify the -Xmx inside eclipse by going to run->configuration->vm arguments and set the -Xmx there, everything works fine :)

like image 75
user247866 Avatar answered Dec 08 '25 19:12

user247866



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!