I tried to find the answer to this question, but I still could not.
I have a 64-bit machine with 256 GB of RAM.
I am trying to execute a Java program that references MySQL. And he needs a quiet large heap size, because when I used the VM argument -Xmx1024m after a few minutes, this pops up:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
But when I tried to set the program's VM argument to -Xmx2048m or more, it did not work and said:
Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap
I read that setting -Xmx2048 not a problem for a 64-bit machine, but I really don't know why it does not work on my machine.
java -version output: 
wmic OS gets FreePhysicalMemory / Value output :
FreePhysicalMemory=251663664
wmic computersystem gets TotalPhysicalMemory output:
TotalPhysicalMemory 274811621376
wmic os get osarchitecture output
OSArchitecture 64-bit
I could not execute systeminfo|find "Memory" because it is talking about the wrong syntax. I'm also not sure why.
java memory heap-memory
fuschia
source share