7066129: GarbageCollectorMXBean#getLastGcInfo leaks native memory

Make GCStatInfo a resource object

Reviewed-by: phh, coleenp
This commit is contained in:
Dmitry Samersoff 2012-01-25 02:29:05 +04:00
parent d0b33ef971
commit 501bad4fd6
4 changed files with 13 additions and 12 deletions

View file

@ -44,7 +44,8 @@ void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, cons
// 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);