Basically we've noticed that on some computers setting the JVM option -Xmx (max heap size) sometimes cause the JVM to fail to initialize, even if there's more than adequate RAM on the system.
So for example, on a 4gb machine, we have -Xmx1024m which fails but -Xmx800m works. I could understand on a 1gb machine, even a 2gb machine, but on a 4gb machine, especially considering that Windows, Linux, etc. can swap the RAM out, why does this fail?
I've seen a lot of threads and questions saying to reduce your max heap size, but no one can explain why it fails which is what I'm really looking for.
As well, how do you say consume as much memory as you want up to a certain size then?
This is because the JVM steadily increases heap usage percentage until the garbage collection process frees up memory again. High heap usage occurs when the garbage collection process cannot keep up. An indicator of high heap usage is when the garbage collection is incapable of reducing the heap usage to around 30%.
This resource memory used by the JVM is often called overhead. The recommended minimum starting memory point for 64-bit Maximo 7.5 JVMs systems is 3584 MB. Therefore we recommended that physical memory availability for each JVM be 4096 MB;0.5 GB is for JVM allocation and 512 MB is for overhead.
Under the Java tab, select JVM Options. Edit the -Xmx256m option. This option sets the JVM heap size. Set the -Xmx256m option to a higher value, such as Xmx1024m.
But in 99% of the cases it is completely normal behaviour by the JVM. What you have specified via the -Xmx switches is limiting the memory consumed by your application heap. But besides the memory consumed by your application, the JVM itself also needs some elbow room.
It's possible that this is due to virtual address space fragmentation. It may not be possible to reserve a contiguous 1024MB address range for the maximum potential size of the heap, depending on the load addresses of DLLs, threads' stack locations, immovable native memory allocations, kernel reserved addresses and so forth, especially in a 32-bit process.
I came across this issue a while ago with Windows XP. On most XP machines I could allocate 1400MB, while others were only 1200MB. The consensus was fragmentation as Jeffrey Hantin says in the other answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With