user3198683
user3198683

Reputation: 13

Relation between RAM size and Virtual memory with JVM heap size

for performance testing, i need 2 GB of heap memory,so i am setting the parameter in java setting via "-Xmx2048m" and also increasing the virtual memory...but while running the application, it is giving errors like "the java run time environment cannot be loaded" and "Several JVM running in the same process caused an error", (in fact, it is not giving same error for any value more than 1 GB). so is it possible to set Heap memory to be 2 GB? or it can be maximum of 1 GB only? if yes, how to do it?? I'm using windows 7, 64 bit with RAM size of 8 GB..and using java 1.6

Upvotes: 0

Views: 2428

Answers (1)

Michał Kosmulski
Michał Kosmulski

Reputation: 10020

Since you are running a 32-bit JVM, there is a limit on how much memory the process can use. Due to how virtual memory is laid out, 32-bit processes can only access 2 GB of memory (or up to 3-4 GB with special settings). Since Java needs some memory for its own bookkeeping, which is not part of the heap available to your application, the actual usuable limit for -Xmx must be somewhere below 2 GB. According to this answer, the limit for 32-bit Java on Windows is -Xmx1500m (not sure if it has changed in newer releases, but due to the limitations outlined above, it must be below 2 GB so it's likely to have stayd at 1500 MB).

Upvotes: 1

Related Questions