7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App

Handlize MemoryUsage klass oop in createGCInfo routine

Reviewed-by: tonyp, fparain, ysr, jcoomes
This commit is contained in:
John Cuthbertson 2011-08-11 11:36:29 -07:00
parent e6603b37f2
commit 0da9dc64d2

View file

@ -92,7 +92,6 @@ static Handle getGcInfoBuilder(GCMemoryManager *gcManager,TRAPS) {
&args,
CHECK_NH);
return Handle(THREAD,(oop)result.get_jobject());
}
static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TRAPS) {
@ -100,9 +99,16 @@ static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TR
// Fill the arrays of MemoryUsage objects with before and after GC
// per pool memory usage
klassOop muKlass = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); objArrayOop bu = oopFactory::new_objArray( muKlass,MemoryService::num_memory_pools(), CHECK_NH);
klassOop mu_klass = Management::java_lang_management_MemoryUsage_klass(CHECK_NH);
instanceKlassHandle mu_kh(THREAD, mu_klass);
// The array allocations below should use a handle containing mu_klass
// as the first allocation could trigger a GC, causing the actual
// klass oop to move, and leaving mu_klass pointing to the old
// location.
objArrayOop bu = oopFactory::new_objArray(mu_kh(), MemoryService::num_memory_pools(), CHECK_NH);
objArrayHandle usage_before_gc_ah(THREAD, bu);
objArrayOop au = oopFactory::new_objArray(muKlass,MemoryService::num_memory_pools(), CHECK_NH);
objArrayOop au = oopFactory::new_objArray(mu_kh(), MemoryService::num_memory_pools(), CHECK_NH);
objArrayHandle usage_after_gc_ah(THREAD, au);
for (int i = 0; i < MemoryService::num_memory_pools(); i++) {