1

I have a 64 bit machine with 8 GB RAM , windows 7. I am using 64 bit JVM. Still I am unable to set Max heap size more than 1600 M. I have read almost all the answers related to this topic on stackoverflow.

Whenever I try to set max heap as -Xmx2048M I am getting:

Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.

I have tried setting max heap size with _JAVA_OPTION system variable and also through:

Run -> Run Configuration -> Arguments path.

Both the times I am getting same error. RAM is almost free.

What is getting wrong?

demongolem
  • 9,474
  • 36
  • 90
  • 105
Yashu
  • 49
  • 12
  • try `-Xmx2048m` or `-Xmx2g` (lowercase m and g) – bkis Jan 20 '17 at 11:57
  • @mumpitz That doesn't make a difference. – Kayaman Jan 20 '17 at 12:05
  • @Kayaman i remember once having the case where the jvm didn't want uppercase letters in the end of this argument. i don't remember if it was due to and old version or whatever, though. – bkis Jan 20 '17 at 12:06
  • 8
    Are you *really sure* that you are using a 64 bit JVM? `1600M` sounds pretty much like a typical limit of a 32 bit JVM. You can use the `-showversion` option to let the JVM print the relevant information without terminating. – Holger Jan 20 '17 at 12:07
  • How do you start your application? – SubOptimal Jan 20 '17 at 12:36
  • Is your system 32 or 64 bit? check using keys: "WinFlag" + "Pause" – Krzysztof Cichocki Jan 20 '17 at 12:41
  • This will happen on Windows if you don't have enough free memory. In Task Manager how much memory does it say is free? – Peter Lawrey Jan 20 '17 at 13:34
  • Below thread has similar discussion. Hope it helps. http://stackoverflow.com/questions/1434779/maximum-java-heap-size-of-a-32-bit-jvm-on-a-64-bit-os – Chetan K Jan 26 '17 at 15:16

1 Answers1

0

Server JVM Default Initial and Maximum Heap Sizes

The default initial and maximum heap sizes work similarly on the server JVM as it does on the client JVM, except that the default values can go higher. On 32-bit JVMs, the default maximum heap size can be up to 1 GB if there is 4 GB or more of physical memory.

On 64-bit JVMs, the default maximum heap size can be up to 32 GB if there is 128 GB or more of physical memory.

You can always set a higher or lower initial and maximum heap by specifying those values directly; see the next section.

Oracle official documentation on Java 8 min/max heap

Ramesh
  • 76
  • 1
  • 9