Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7066129

GarbageCollectorMXBean#getLastGcInfo leaks native memory

XMLWordPrintable

    • svc
    • b12
    • generic, x86
    • generic, linux
    • Verified

        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.

              dsamersoff Dmitriy Samersoff
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: