I’m trying to run an algorithm that requires a few hundred megabytes of memory within eclipse, and I’ve specified VM arguments -Xmx512m, but I can’t get past some arbitrary memory limit which seems to decrease as I continually try to run my programs. Physical memory is fine…what could be the issue?
Share
Eclipse takes VM arguments, but those are for the Eclipse platform itself, you need to modify the applications Launch Configuration to ensure it has enough memory.
When you run a program within Eclipse it creates a new Launch Configuration with default parameters. You can modify those parameters by selecting Run->Run Configurations.. (or Debug->Debug Configurations…), then select the relevant configuration. If it is a Java main app, the configuration will be under Java Application, probably with the name of the class or project you selected when you first ran it.
Select the launch configuration, then the Arguments tab, then enter the relevant JVM arguments (i.e -Xmx512m) in the VM arguments pane. You can also enter Program arguments to pass to the main method if you wish.
(source: modumind.com)
Update: another parameter to try passing is
-XX:MaxPermSize=128m, if your algorithm is creating lots of method and/or class objects (which sounds like it is the case).