comparison 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
comparison
equal deleted inserted replaced
1:3de81891288e 2:7e8da6350be3
42 42
43 void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, const char *cause) { 43 void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, const char *cause) {
44 // Make a copy of the last GC statistics 44 // Make a copy of the last GC statistics
45 // GC may occur between now and the creation of the notification 45 // GC may occur between now and the creation of the notification
46 int num_pools = MemoryService::num_memory_pools(); 46 int num_pools = MemoryService::num_memory_pools();
47 GCStatInfo* stat = new GCStatInfo(num_pools); 47 // stat is deallocated inside GCNotificationRequest
48 GCStatInfo* stat = new(ResourceObj::C_HEAP) GCStatInfo(num_pools);
48 mgr->get_last_gc_stat(stat); 49 mgr->get_last_gc_stat(stat);
49 GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat); 50 GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat);
50 addRequest(request); 51 addRequest(request);
51 } 52 }
52 53