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

Tests that stress Platform MBeans and check memory usage should be developed.

XMLWordPrintable

      There are some memory leaks issues caused by monitoring_management classes usage (JDK-7066129, JDK-7125594, JDK-7143760).
      I think we could create tests that intensively using Platform MBeans, for example test case from CR JDK-7066129:

      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();
                  }
              }
          }
      }

      If there are no leaks such test should not force resident memory growth. So we can simply check that it will not grow due some period of time (1 minute for example).

            Unassigned Unassigned
            fzhinkin Filipp Zhinkin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: