Question

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.

Was it helpful?

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

OTHER TIPS

Couple of times in my past experience, I observed that 64-bit OS can also have 32-bit JVM and it leads to the confusion.

Apart from this, I don't think you will be able to allocate full 4 GB space to JVM, there are other programs which consumes the memory also.

You can think of allocating 4 GB only if you are running on >6 GB machine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top