JDK-7066129 : GarbageCollectorMXBean#getLastGcInfo leaks native memory
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 6u26,6u30
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2011-07-12
  • Updated: 2017-09-14
  • 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 Availabitlity Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7 JDK 8 Other
5.0u45,hs20.6Fixed 6u31-revFixed 7u4Fixed 8Fixed hs20.6Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
Using the getLastGcInfo on the sun jdk extension causes a native memory leak. Running the following program, one can easily see the RES memory of the java process increasing. This is really problematic since this method seems to be used by many libraries out there...

import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.util.List;

public class TestMemoryLeak {

    public static void main(String[] args) throws Exception {
        while (true) {
            List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
            for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
                ((com.sun.management.GarbageCollectorMXBean) gcMxBean).getLastGcInfo();
            }
        }
    }
}


REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/bf864f701a4a
2012-03-22

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/bf864f701a4a
2012-01-27

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/bf864f701a4a
2012-01-25

EVALUATION GCStatInfo structure in hotspot is allocated, but never freed.
2011-12-28