Eclipse memory settings when getting “Java Heap Space” and “Out of Memory”

前端 未结 11 755
野的像风
野的像风 2020-11-27 13:06

When trying to launch and run a flex/java project in eclipse I kept getting a \"Out of Memory Exception\" and \"Java Heap Space\" using Eclipse, Tomcat and a JRE.

Wh

相关标签:
11条回答
  • 2020-11-27 13:35

    My FLashBuilder is crashing all the time when I try to release a new version or I abuse of the "Mark Occurrences" and "Link with editor" features.

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

    Especially by setting the FlashBuilder.ini to 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, 4gb DDR3, windows 7 64Bit.

    0 讨论(0)
  • 2020-11-27 13:35

    There's a couple of different memory settings for good reason.

    The eclipse memory setting is because Eclipse is a large java program. if you are going to have a huge amount of files open in a couple of projects, then you're going to want to give Eclipse more ram. This is an issue only on "enterprise" systems normally personal projects wont use that many file handles or interfaces.

    The JRE setting is how much ram to allow the java runtime when you run your project. This is probably the one you want when you are running some memory hogging application. I've run mathematical projects that needed a few gigs of ram and had to really tell the JRE it was okay, the JVM kept assuming my program was in some leaky runaway state, but I was doing it on purpose, and had to tell JVM specifically what it was allowed to use.

    Then Catalina's memory setting is for the application server Tomcat. That server needs memory for each application and concurrent users. This blends with the JRE number because your project might be a web application and I'm not sure which one needs the memory.

    0 讨论(0)
  • 2020-11-27 13:39

    Adobe Flash Builder 4.6 Read Me.pdf recommendeds that you edit the eclipse.ini file for your Eclipse instance, so that it includes the following settings:

    -vmargs -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=64m
    
    0 讨论(0)
  • 2020-11-27 13:40

    Tomcat in Eclipse does not use catalina.sh or bat. To setup memory for managed Tomcat use VM settings in server run configuration

    0 讨论(0)
  • 2020-11-27 13:51

    Also have some problems with the memory in Eclipse, but the way it is for us, is not when the actual run, it is when Eclipse is doing a refresh (manually or auto), or if trying to build it, eclipse crash and are shutdown.

    In the logs there are some info:

    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 adjust the eclipse.ini to use these values it doesn't seems to be applied.

    -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
    

    Any that have seen this issue before?
    Will add that the project that are used is very large.

    0 讨论(0)
提交回复
热议问题