8025279: metaspace/flags/maxMetaspaceSize throws OOM: out of Compressed Klass space

Fri, 27 Sep 2013 10:23:12 +0200

author
mgerdin
date
Fri, 27 Sep 2013 10:23:12 +0200
changeset 5808
bc918fd1e584
parent 5807
c319b188c7b2
child 5810
ccef6e165e8b

8025279: metaspace/flags/maxMetaspaceSize throws OOM: out of Compressed Klass space
Summary: Only put "Compressed class space" as OOM cause if actually using Compressed class space
Reviewed-by: jwilhelm, stefank, ehelin, coleenp

src/share/vm/memory/metaspace.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/metaspace.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/memory/metaspace.cpp	Thu Sep 26 12:49:45 2013 +0200
     1.2 +++ b/src/share/vm/memory/metaspace.cpp	Fri Sep 27 10:23:12 2013 +0200
     1.3 @@ -3104,7 +3104,7 @@
     1.4  MetaWord* Metaspace::allocate(size_t word_size, MetadataType mdtype) {
     1.5    // DumpSharedSpaces doesn't use class metadata area (yet)
     1.6    // Also, don't use class_vsm() unless UseCompressedClassPointers is true.
     1.7 -  if (mdtype == ClassType && using_class_space()) {
     1.8 +  if (is_class_space_allocation(mdtype)) {
     1.9      return  class_vsm()->allocate(word_size);
    1.10    } else {
    1.11      return  vsm()->allocate(word_size);
    1.12 @@ -3252,8 +3252,8 @@
    1.13          MetaspaceAux::dump(gclog_or_tty);
    1.14        }
    1.15        // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
    1.16 -      const char* space_string = (mdtype == ClassType) ? "Compressed class space" :
    1.17 -                                                         "Metadata space";
    1.18 +      const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" :
    1.19 +                                                                     "Metadata space";
    1.20        report_java_out_of_memory(space_string);
    1.21  
    1.22        if (JvmtiExport::should_post_resource_exhausted()) {
    1.23 @@ -3261,7 +3261,7 @@
    1.24              JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR,
    1.25              space_string);
    1.26        }
    1.27 -      if (mdtype == ClassType) {
    1.28 +      if (is_class_space_allocation(mdtype)) {
    1.29          THROW_OOP_0(Universe::out_of_memory_error_class_metaspace());
    1.30        } else {
    1.31          THROW_OOP_0(Universe::out_of_memory_error_metaspace());
     2.1 --- a/src/share/vm/memory/metaspace.hpp	Thu Sep 26 12:49:45 2013 +0200
     2.2 +++ b/src/share/vm/memory/metaspace.hpp	Fri Sep 27 10:23:12 2013 +0200
     2.3 @@ -235,6 +235,9 @@
     2.4      return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers && !DumpSharedSpaces);
     2.5    }
     2.6  
     2.7 +  static bool is_class_space_allocation(MetadataType mdType) {
     2.8 +    return mdType == ClassType && using_class_space();
     2.9 +  }
    2.10  };
    2.11  
    2.12  class MetaspaceAux : AllStatic {

mercurial