Request for review: 8020530 Non heap memory size calculated incorrectly

Mandy Chung mandy.chung at
Tue Aug 20 14:52:23 PDT 2013

On 8/20/2013 5:38 AM, Staffan Larsen wrote:
> That doesn't make a lot of sense to me. Why would a pool have undefined values?
> The Metaspace pool has no max value (unless you specify -XX:MaxMetaspaceSize=), thus undefined.
>> If a subset of pools have undefined values why report completely fallacious values of -1?
> The javadoc for MemoryUsage says getMax() returns -1 if the maximum memory size is undefined.

Yes the spec allows implementation of memory pools with undefined max.  
"used" and "committed" must have a value and the "committed" memory is 
guaranteed to be available for the VM to use.  "max" will give an idea 
of the upper bound how much memory can be allocated from it; however, 
there is no guarantee that amount of memory is available for the VM.

>> It also isn't clear how this relates to the "committed" value in the failure. What gets reported now?
> I guess there can still be a committed value even if we don't have a max value for how much we might commit in the future: used <= committed <= max.

The MemoryUsage constructor throws IAE if committed > max if max is 
defined.  Perhaps it would be better if max should be Long.MAX_VALUE if 
undefined (a different issue than this bug).


> /Staffan
>> Thanks,
>> David
>>> Thanks,
>>> Vladimir

More information about the hotspot-dev mailing list