RFR: 8025313: MetaspaceMemoryPool incorrectly reports undefined size for max

Jesper Wilhelmsson jesper.wilhelmsson at oracle.com
Mon Sep 30 18:52:17 UTC 2013

Thomas Schatzl skrev 30/9/13 5:50 PM:
> Hi,
> On Mon, 2013-09-30 at 17:20 +0200, Erik Helin wrote:
>> Hi all,
>> this patch fixes an issue where the metaspace memory pool reports -1 for
>> MemoryPoolMXBean.getUsage().getMax(), even though the user has set
>> MaxMetaspaceSize on the command line.
>> The problem is that we in collectorPolicy.cpp use FLAG_SET_ERGO when
>> aligning MaxMetaspaceSize while at the same time relying on
>> FLAG_IS_CMDLINE in memoryPool.cpp when deciding what to return for
>> MetaspacePool::calculate_max_size.
>> This patch removes FLAG_SET_ERGO and instead simply sets
>> MaxMetaspaceSize.
> Why not check for max_uintx in MetaspacePool::calculate_max_size()? It
> seems to me that the actual value is important here for returning it to
> the MetaspaceMemoryPool, not where it came from.
> I mean, what if the user set a value of max_uintx on the commandline? It
> always seems unintuitive to me when the user sets a flag to the default
> value on the command line and the result is different than when not
> setting anything.

I think there is a difference. Not setting a flag indicates that it is OK for 
the VM to ergonomically change the value at will. Explicitly setting a flag 
(even if it is to the default value) indicates that the user really wants this 
value and ergonomics should try its best to leave it alone.

>> Webrev:
>> http://cr.openjdk.java.net/~ehelin/8025313/webrev.00/
> Thomas

More information about the hotspot-gc-dev mailing list