Asked  6 Months ago    Answers:  2   Viewed   27 times

I am getting the following exception repeatedly each time I try to run the program.

Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine.

I tried to increase my virtual memory (page size) and RAM size, but to no avail.

How can I eliminate this error?



Run the JVM with -XX:MaxHeapSize=512m (or any big number as you need) (or -Xmx512m for short)

Tuesday, June 1, 2021
answered 6 Months ago

It looks like the machine you're trying to run this on has only 256 MB memory.

Maybe the JVM tries to allocate a large, contiguous block of 64 MB memory. The 192 MB that you have free might be fragmented into smaller pieces, so that there is no contiguous block of 64 MB free to allocate.

Try starting your Java program with a smaller heap size, for example:

java -Xms16m ...
Friday, July 23, 2021
answered 5 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :