JDK-7143760 : Memory leak in GarbageCollectionNotifications
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 7,7u4
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_10
  • CPU: generic,sparc
  • Submitted: 2012-02-08
  • Updated: 2012-03-24
  • Resolved: 2012-03-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Related Reports
Duplicate :  
We found that when attached to a process with jconsole the value for "Used heap" was growing even though the main class of the attachee was a do-nothing-class (attached). The leak appeared to continue growing after jconsole was detached.

The leak did not reproduce with a recent HotSpot running on JDK6u29, so we looked at recent changes in src/classes/sun/management and tried un-applying e0c3fd538f1f
[ http://hg.openjdk.java.net/jdk7u/jdk7u-dev/jdk/rev/e0c3fd538f1f ]

The leak did not reproduce when running with the change reverted so this particular change seems to be a likely culprit for the leak but we're not familiar enogh with the management classes to be able to see exactly where the leak occurs.

We looked at a hprof dump (attached) of the leaking process and found j.l.m.MemoryUsage at the top of the heap histogram with 98430 instances.

EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/1891640ca63f

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/1891640ca63f

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/1891640ca63f

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/1891640ca63f

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/1891640ca63f

EVALUATION There's a missing HandleMark at the beginning of the GCNotifier::sendNotificatin() method. Without this HandleMark, all handles used when creating MemoryUsage instances are kept alive causing a double leak: in the Java heap and in the thread local handle area of the service thread. Suggested fix: adding the HandleMark: void GCNotifier::sendNotification(TRAPS) { ResourceMark rm(THREAD); HandleMark hm(THREAD); <---------- GCNotificationRequest *request = getRequest(); if(request != NULL) {