Eclipse memory settings when receiving "Java Heap Space" and "Out of Memory"

While trying to start and run the flex / java project in eclipse, I continued to get "memory exception" and "Java heap space" using Eclipse, Tomcat and JRE.

When I tried to configure the memory settings, I found three places to configure them:

  • eclipse.ini

  • JRE settings in window> Settings

  • Catalina.sh or Catalina.bat

What is the difference between installing -xms and -xmx in these different places, and what does it mean?

Is there a way to verify that these memory settings are set appropriately?

What are the optimal -xms and -xmx options for a computer with 2 GB of RAM?

Any other memory tips?

Thank.

+56
java eclipse flex memory
Dec 02 '08 at 14:28
source share
11 answers

-xms is the initial memory (when starting the VM), -xmx is the maximum memory for the VM

  • eclipse.ini: memory for the virtual machine running eclipse
  • jre: memory for java programs is launched from eclipse
  • catalina.sh: memory for your tomcat server
+51
Dec 02 '08 at 14:33
source share

First of all, I suggest you narrow down the problem to which the component throws an “Exception from memory”.

It could be:

  • Eclipse (what I doubt)
  • Your application in tomcat

The JVM parameters -xms and -xmx represent a bunch of "initial memory" and "maximum memory". Forget "start memory." This will not help you now, and you should change this parameter only if you are sure that your application will quickly consume this amount of memory.

In production, I think the only parameter you can change is -xmx in the Catalina.sh or Catalina.bat files. But if you test your webapp directly from Eclipse with the Tomcat debugging environment configured, you can just go to Debug Configurations> Apache Tomcat> Arguments> VM Arguments and set -xmx there.

As for the optimal -xmx for 2gb, it depends on your environment and the number of requests your application may require. I would try values ​​from 500 MB to 1 GB. Check the "zone" of the virtual memory of your OS and the limit of the JVM itself.

+13
Dec 02 '08 at 15:08
source share

In our case, 2 questions were found.

  • Memory stopped, and we, where it was necessary, to set the maximum launch size for launch. I guess he used memory faster than he could allocate it. In our case. -XX: PermSize = 256m -XX: MaxPermSize = 256m

  • We use Clearcase, and the plugin from Rational Clearcase SCM (7.0.0.2) was used in Eclipse. The plugin was the reason Eclipse failed. And at the moment we do not know why, but it may be good to know for others. I was forced to turn it off.

+3
Nov 12 '09 at 12:46
source share

Tomcat in Eclipse does not use catalina.sh or bat. To configure memory for managed Tomcat, use the VM settings in the server configuration

+2
Mar 24 '10 at 22:16
source share

My FLashBuilder constantly crashes when I try to release a new version, or I abuse the "Mark Occurrences" and "Link with editor" features.

I significantly improved my flash performance by following the steps http://www.redcodelabs.com/2012/03/eclipse-speed-up-flashbuilder/

Especially by installing FlashBuilder.ini in the following configuration

 -vm C:/jdk1.6.0_25/bin -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar –launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502 -product org.eclipse.epp.package.jee.product –launcher.defaultAction openFile –launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform –launcher.XXMaxPermSize 256m –launcher.defaultAction openFile -vmargs -server -Dosgi.requiredJavaVersion=1.5 -Xmn128m -Xms1024m -Xmx1024m -Xss2m -XX:PermSize=128m -XX:MaxPermSize=128m -XX:+UseParallelGC 

My hardware configuration is Intel i3 cpu, 4 GB DDR3, Windows 7 64Bit.

+2
Apr 03 2018-12-12T00:
source share

There are a couple of different memory settings for a good reason.

The value of eclipse memory is because Eclipse is a great Java program. if you have a huge number of files open in several projects, then you will want to give Eclipse more bar. This is a problem only on "corporate" systems, usually personal projects usually do not use many files or interfaces.

The JRE parameter is the number of bars that allows you to start the java environment when you start your project. This is probably the one you need when you run the application to freeze memory. I started math projects that needed several ram concerts, and I really had to tell JRE that everything was fine, the JVM continued to believe that my program was in some kind of explicit runaway state, but I did it on purpose and had to say JVM in particular, what was allowed to use.

The Catalina memory option then refers to the Tomcat application server. This server needs memory for each application and simultaneously working users. This matches the JRE number because your project may be a web application, and I'm not sure which one is needed.

+1
Dec 02 '08 at 14:56
source share

There are also some memory problems in Eclipse, but the way it is done for us is not when the actual launch, when Eclipse does the update (manually or automatically) or tries to create it, eclipse crashes and stops.

In the magazines there is information:

 Heap def new generation total 36352K, used 11534K [0x10040000, 0x127b0000, 0x14f00000) eden space 32320K, 29% used [0x10040000, 0x10994c30, 0x11fd0000) from space 4032K, 49% used [0x123c0000, 0x125aed80, 0x127b0000) to space 4032K, 0% used [0x11fd0000, 0x11fd0000, 0x123c0000) tenured generation total 483968K, used 125994K [0x14f00000, 0x327a0000, 0x50040000) the space 483968K, 26% used [0x14f00000, 0x1ca0ab38, 0x1ca0ac00, 0x327a0000) compacting perm gen total 58112K, used 57928K [0x50040000, 0x53900000, 0x60040000) the space 58112K, 99% used [0x50040000, 0x538d2160, 0x538d2200, 0x53900000) No shared spaces configured. 

Even if I configure eclipse.ini to use these values, it does not seem to apply.

 -showsplash org.eclipse.platform --launcher.XXMaxPermSize 1024M -framework plugins\org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar -vmargs -Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms512m -Xmx1024m 

Anyone who has seen this problem before?
We add that the project used is very large.

+1
Nov 12 '09 at 6:22
source share

I have the following settings:

 -vmargs ... -Duser.name=... -XX:PermSize=256m -XX:MaxPermSize=256m -Xmn128m -Xms256m -Xmx768m 

Eclipse accidentally crashed before I set PermSize to MaxPermSize.

+1
Jun 24 '10 at 16:03
source share

If you see a lack of memory, consider whether this is plausible: do you really need such a large memory? If not (i.e. when you do not have huge objects, and if for some reason you do not need to create millions of objects), most likely you have a memory leak.

In Java, this means that you keep the reference to the object somewhere, even if you no longer need it. Common reasons for this are forgetting to call close () on resources (files, database connections, operators and result sets, etc.).

If you suspect a memory leak, use the profiler to find which object takes up all available memory.

0
Dec 02 '08 at 16:02
source share

We encounter the problem of running out of memory with Ant when trying to create a very large Flex project, which may not be resolved by increasing the memory allocated for Ant, or by adding fork = true pair. This turned out to be a bug in Flex 3.4.0 sdk. I finally figured it out after asking developers for their sdk version and returning to 3.3.0.

For the curious.

I tracked the error to the interface file, in which a couple of additional accessories "get / set maskTrackSkin" were added. A space heap error if any additional functions were added to the interface and that the interface was not degraded in the project that received the heap space error. Hope this helps someone.

0
Feb 24 '10 at 17:10
source share

Adobe Flash Builder 4.6 Read Me.pdf recommends editing the eclipse.ini file for your Eclipse instance to include the following settings:

 -vmargs -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=64m 
0
Sep 30
source share



All Articles