Review request: 8025059: Metspace::should_expand mixes bytes and words in check against MaxMetaspaceSize

Stefan Karlsson stefan.karlsson at
Thu Sep 19 07:59:15 PDT 2013

The following code in Metaspace::should_expand:

if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) {
   size_t real_allocated = Metaspace::space_list()->reserved_words() +
   if (real_allocated >= MaxMetaspaceSize) {
     return false;

doesn't convert Metaspace::space_list()->reserved_words() to bytes, as 
it should.

Note that when JDK-8024547 gets fixed, this check will be rewritten to 
limit the amount of committed memory in both the Class and NonClass 
metaspaces. See: MaxMetaspaceSize 
should limit the committed memory used by the metaspaces

Testing: I've run our internal testing that sets the MaxMetaspaceSize.


More information about the hotspot-dev mailing list