diff src/share/vm/services/gcNotifier.cpp @ 3036:bf864f701a4a

7066129: GarbageCollectorMXBean#getLastGcInfo leaks native memory Summary: Make GCStatInfo a resource object Reviewed-by: phh, coleenp
author dsamersoff
date Wed, 25 Jan 2012 02:29:05 +0400
parents 87e40b34bc2b
children 1891640ca63f
line wrap: on
line diff
--- a/src/share/vm/services/gcNotifier.cpp	Mon Jan 23 17:45:32 2012 -0800
+++ b/src/share/vm/services/gcNotifier.cpp	Wed Jan 25 02:29:05 2012 +0400
@@ -44,7 +44,8 @@
   // Make a copy of the last GC statistics
   // GC may occur between now and the creation of the notification
   int num_pools = MemoryService::num_memory_pools();
-  GCStatInfo* stat = new GCStatInfo(num_pools);
+  // stat is deallocated inside GCNotificationRequest
+  GCStatInfo* stat = new(ResourceObj::C_HEAP) GCStatInfo(num_pools);
   mgr->get_last_gc_stat(stat);
   GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat);
   addRequest(request);