7018257: jmm_DumpThreads allocates into permgen

Fri, 11 Feb 2011 14:15:16 +0100

author
stefank
date
Fri, 11 Feb 2011 14:15:16 +0100
changeset 2537
55cc33cf55bc
parent 2536
183658a2d0b3
child 2538
f7702f8c0e25

7018257: jmm_DumpThreads allocates into permgen
Summary: Don't allocate in permgen
Reviewed-by: ysr, sla

src/share/vm/memory/oopFactory.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/oopFactory.hpp file | annotate | diff | comparison | revisions
src/share/vm/services/management.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/memory/oopFactory.cpp	Thu Feb 10 14:48:07 2011 -0800
     1.2 +++ b/src/share/vm/memory/oopFactory.cpp	Fri Feb 11 14:15:16 2011 +0100
     1.3 @@ -92,12 +92,21 @@
     1.4    }
     1.5  }
     1.6  
     1.7 -objArrayOop oopFactory::new_system_objArray(int length, TRAPS) {
     1.8 +objArrayOop oopFactory::new_system_objArray(int length, bool in_perm_gen, TRAPS) {
     1.9    int size = objArrayOopDesc::object_size(length);
    1.10    KlassHandle klass (THREAD, Universe::systemObjArrayKlassObj());
    1.11 -  objArrayOop o = (objArrayOop)
    1.12 -    Universe::heap()->permanent_array_allocate(klass, size, length, CHECK_NULL);
    1.13 +  oop o;
    1.14 +  if (in_perm_gen) {
    1.15 +    o = Universe::heap()->permanent_array_allocate(klass, size, length, CHECK_NULL);
    1.16 +  } else {
    1.17 +    o = Universe::heap()->array_allocate(klass, size, length, CHECK_NULL);
    1.18 +  }
    1.19    // initialization not needed, allocated cleared
    1.20 +  return (objArrayOop) o;
    1.21 +}
    1.22 +
    1.23 +objArrayOop oopFactory::new_system_objArray(int length, TRAPS) {
    1.24 +  objArrayOop o = oopFactory::new_system_objArray(length, true, CHECK_NULL);
    1.25    return o;
    1.26  }
    1.27  
     2.1 --- a/src/share/vm/memory/oopFactory.hpp	Thu Feb 10 14:48:07 2011 -0800
     2.2 +++ b/src/share/vm/memory/oopFactory.hpp	Fri Feb 11 14:15:16 2011 +0100
     2.3 @@ -102,6 +102,7 @@
     2.4  
     2.5    // System object arrays
     2.6    static objArrayOop     new_system_objArray(int length, TRAPS);
     2.7 +  static objArrayOop     new_system_objArray(int length, bool in_perm_gen, TRAPS);
     2.8  
     2.9    // Regular object arrays
    2.10    static objArrayOop     new_objArray(klassOop klass, int length, TRAPS);
     3.1 --- a/src/share/vm/services/management.cpp	Thu Feb 10 14:48:07 2011 -0800
     3.2 +++ b/src/share/vm/services/management.cpp	Fri Feb 11 14:15:16 2011 +0100
     3.3 @@ -1310,7 +1310,7 @@
     3.4      if (locked_monitors) {
     3.5        // Constructs Object[] and int[] to contain the object monitor and the stack depth
     3.6        // where the thread locked it
     3.7 -      objArrayOop array = oopFactory::new_system_objArray(num_locked_monitors, CHECK_NULL);
     3.8 +      objArrayOop array = oopFactory::new_system_objArray(num_locked_monitors, false, CHECK_NULL);
     3.9        objArrayHandle mh(THREAD, array);
    3.10        monitors_array = mh;
    3.11  
    3.12 @@ -1352,7 +1352,7 @@
    3.13        GrowableArray<instanceOop>* locks = (tcl != NULL ? tcl->owned_locks() : NULL);
    3.14        int num_locked_synchronizers = (locks != NULL ? locks->length() : 0);
    3.15  
    3.16 -      objArrayOop array = oopFactory::new_system_objArray(num_locked_synchronizers, CHECK_NULL);
    3.17 +      objArrayOop array = oopFactory::new_system_objArray(num_locked_synchronizers, false, CHECK_NULL);
    3.18        objArrayHandle sh(THREAD, array);
    3.19        synchronizers_array = sh;
    3.20  

mercurial