Search code examples
javawindows-764-bitheap-memory

setting up 64bit windows 7 for large JRE7 heap size


I have been trying to run java with 4G max and min heap size on a 64bit win 7 machine but when I check task manager I only see about 2G for java.exe. I read there are windows restrictions as well. How do I set up windows 7 and jre7 x64 so that I can run jave with 4G heap size? Thanks.


Solution

  • What parameters are you using?

    http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html

    For example related to your case:

    • -Xms : sets initial Java heap size

    • -Xmx : sets maximum Java heap size

    If you are using the -Xmx parameter then you will see 4G in your task manager, ONLY IF your application really needs it. On the other hand if your are using the -Xms parameter (in that case you also need to need to set -Xmx parameter at an equal or larger value) then you should expect to see that value on the task manager. So, only if you set -Xms4096M and -Xmx4096M and the JVM fails to start then you have an issue. If it starts normally then you do not have a problem.

    Also regardless of the RAM you are having (not in your case since we are only talking 4G) even Windows 7 (64bit) have different limits according to their edition.

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx#physical_memory_limits_windows_7