This is a very simple fix for a memory leak. The ThreadService::find_deadlocks_at_safepoint method leaks on DeadlockCycle object every time it is called.
A DeadlockCycle object, referenced by the 'cycle' local variable, is pre-allocated and used to store blocked threads. If a deadlock is found, 'cycle' is added to the deadlock list (referenced by the 'deadlocks' local variable) and a new DeadlockCycle object is created and re-assign to the 'cycle' variable. Once all the threads have been processed, the deadlock list is returned, or NULL if no deadlock has been found. In both case, the last DeadlockCycle object that has been allocated, still referenced by 'cycle', is not returned to caller method nor deallocated, causing the memory leak. The fix is to call delete on the object pointed by 'cycle' before returning the result: http://cr.openjdk.java.net/~fparain/7125594/webrev.00/ I've already received positive reviews from Serguei Spitsyn, Dan Daugherty, Mandy Chung and David Holmes. Unless someone objects quickly, I'll proceed and push the fix. Thanks, Fred -- Frederic Parain - Oracle Grenoble Engineering Center - France Email: frederic.par...@oracle.com