Monday, 24 June 2013

OutOfMemoryErrors - java


Some JVMs (Java virtual  machine) put restrictions on the total amount of memory available on the heap. 

If you are getting OutOfMemoryErrors while running Eclipse, the VM can be told to let the heap grow to a larger amount by passing the -vmargs command to the Eclipse launcher. 
eclipse [normal arguments] -vmargs -Xmx256M [more VM args]

You can put the extra memory while initialising the Eclipse by opening  the file  eclipse.ini.
and change the value of Xms512m
Here is an example;

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xms512m

-Xmx1024m

-XX:+UseParallelGC -XX:PermSize=256M -XX:MaxPermSize=512M



  • If the problem is while running a special Test-Case or  Running the project you can increase the reserved memory from JVM by a memory by:

Right click --> Run As --> Run Configurations then click on second tap (x= arguments)
and add -Xmx512M in VM arguments,
               

Best Of luck.

No comments:

Post a Comment