JVM 64 uses a maximum of 2 GB on Windows Server 2012 on Azure

I am using a Windows 2012 server with 7 GB of RAM, which is located on Azure. I installed 64-bit Java on the machine.

When starting jvm, I set the maximum compression level to 4 GB using the argument

-Xmx6g

However, when I run my jar, it encounters an exception from OutOfMemory. I checked the task manager during its operation, and it shows that the memory used for the process reaches a maximum of about 2 GB and never passes by. This is despite the fact that I install heapsize up to 6GB.

On my local PC, where I use a Windows 7 machine with 8 GB of RAM, I do not encounter this problem.

I used the following commands in my java application

System.out.println(System.getProperty("sun.arch.data.model"));
System.out.println("Max Memory: " + Runtime.getRuntime().maxMemory());

And that gives me the following:

Windows Server 2012

64
1670381568

Local pc

64
6681001984

Windows Server JVM? - , ?

+4
2

, .

, java.

.

java -jar "myapp.jar" "myArgs" -Xmx6g 

java -Xmx6g -jar "myapp.jar" "myArgs"
0

All Articles