changeset 2102:55cc33cf55bc

7018257: jmm_DumpThreads allocates into permgen Summary: Don't allocate in permgen Reviewed-by: ysr, sla
author stefank
date Fri, 11 Feb 2011 14:15:16 +0100
parents 183658a2d0b3
children f7702f8c0e25
files src/share/vm/memory/oopFactory.cpp src/share/vm/memory/oopFactory.hpp src/share/vm/services/management.cpp
diffstat 3 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/oopFactory.cpp	Thu Feb 10 14:48:07 2011 -0800
+++ b/src/share/vm/memory/oopFactory.cpp	Fri Feb 11 14:15:16 2011 +0100
@@ -92,12 +92,21 @@
   }
 }
 
-objArrayOop oopFactory::new_system_objArray(int length, TRAPS) {
+objArrayOop oopFactory::new_system_objArray(int length, bool in_perm_gen, TRAPS) {
   int size = objArrayOopDesc::object_size(length);
   KlassHandle klass (THREAD, Universe::systemObjArrayKlassObj());
-  objArrayOop o = (objArrayOop)
-    Universe::heap()->permanent_array_allocate(klass, size, length, CHECK_NULL);
+  oop o;
+  if (in_perm_gen) {
+    o = Universe::heap()->permanent_array_allocate(klass, size, length, CHECK_NULL);
+  } else {
+    o = Universe::heap()->array_allocate(klass, size, length, CHECK_NULL);
+  }
   // initialization not needed, allocated cleared
+  return (objArrayOop) o;
+}
+
+objArrayOop oopFactory::new_system_objArray(int length, TRAPS) {
+  objArrayOop o = oopFactory::new_system_objArray(length, true, CHECK_NULL);
   return o;
 }
 
--- a/src/share/vm/memory/oopFactory.hpp	Thu Feb 10 14:48:07 2011 -0800
+++ b/src/share/vm/memory/oopFactory.hpp	Fri Feb 11 14:15:16 2011 +0100
@@ -102,6 +102,7 @@
 
   // System object arrays
   static objArrayOop     new_system_objArray(int length, TRAPS);
+  static objArrayOop     new_system_objArray(int length, bool in_perm_gen, TRAPS);
 
   // Regular object arrays
   static objArrayOop     new_objArray(klassOop klass, int length, TRAPS);
--- a/src/share/vm/services/management.cpp	Thu Feb 10 14:48:07 2011 -0800
+++ b/src/share/vm/services/management.cpp	Fri Feb 11 14:15:16 2011 +0100
@@ -1310,7 +1310,7 @@
     if (locked_monitors) {
       // Constructs Object[] and int[] to contain the object monitor and the stack depth
       // where the thread locked it
-      objArrayOop array = oopFactory::new_system_objArray(num_locked_monitors, CHECK_NULL);
+      objArrayOop array = oopFactory::new_system_objArray(num_locked_monitors, false, CHECK_NULL);
       objArrayHandle mh(THREAD, array);
       monitors_array = mh;
 
@@ -1352,7 +1352,7 @@
       GrowableArray<instanceOop>* locks = (tcl != NULL ? tcl->owned_locks() : NULL);
       int num_locked_synchronizers = (locks != NULL ? locks->length() : 0);
 
-      objArrayOop array = oopFactory::new_system_objArray(num_locked_synchronizers, CHECK_NULL);
+      objArrayOop array = oopFactory::new_system_objArray(num_locked_synchronizers, false, CHECK_NULL);
       objArrayHandle sh(THREAD, array);
       synchronizers_array = sh;