简体   繁体   中英

STS / Eclipse JVM max heap lower than free memory on machine

I'm trying to increase my max heap in eclipse / STS. I find that the ceiling seems much lower than my free memory. Windows reports 2G available memory in the Task Manager. It appears that the JVM in Eclipse is only able to allocate around 1.2G of that. In the config below found in the eclipse.ini if I change the -Xmx to above 1200m I get an error that the JVM failed to start. Why won't it allow me to allocate more?

-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
-product
com.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vm
C:/bea/jdk160_05/bin/javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dsun.lang.ClassLoader.allowArraySyntax=true
-Xms1200m
-Xmx1200m

This is typically the Windows 2Gb/DLL process limit for 32-bit systems. Java usually (and therefore Eclipse) allocates a contiguous block of memory for its heap. Windows only allows a maximum (normally) of 2Gb for a process on a 32-bit system. (There are some tricks to raise that to 3Gb.) The annoying issue is that Windows DLLs are likely to be mapped to places in memory that eat into that 2Gb -- although they can be moved by a technique called rebasing. On typical Windows 32-bit systems, depending on what is installed, you can get between 1.2Gb and 1.4Gb in a contiguous chunk, and this, therefore, is the most you can get as a Java heap.

The only real way to raise this significantly is by switching to a 64-bit system. There are techniques for moving DLLs and switching to 3Gb for the process limit that can make a modest improvement. See http://msdn.microsoft.com/en-us/windows/hardware/gg487508 for a little more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM