| Author |
Java Heap Size
|
kodi pitta
Greenhorn
Joined: Sep 30, 2003
Posts: 1
|
|
I have set the max heap size for my java program to 512m, by specifying java -Xmx512m. However, when I run a test program that invokes java.lang.Runtime.maxMemory(), which is the amount of memory that the JVM will attempt to use, I don't see 512m, instead I only see about 510MB. How does one explain the difference ?
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
Which java version are you using. When I tested, it is giving 576 MB! In fact, it is actually giving 64MB more than what ever I specify.
|
Mani
Quaerendo Invenietis
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
Okay...the problem I posted is a bug, which was fixed in 1.4.2. Here are the details. But I don't have any answer to the initial question.
|
 |
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
|
|
But I don't have any answer to the initial question. Turns out to be another reported bug: Bug Id 4391499: java.lang.Runtime.maxMemory() returns value different from -Xmx option. However, Sun set the status to "closed, will not be fixed" with the following explanation: Not a bug. The interpretation of the -Xmx flag is VM-dependent. Some VMs, including HotSpot, enforce a lower bound on the effective value of this option.
|
 |
 |
|
|
subject: Java Heap Size
|
|
|