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

Release memory after testing in ThreadsRunner.java

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot
    • gc

      In ThreadsRunner.java, the following `run` method is responsible for coordinating all testing threads.

      public void run() {
              ...
        try {
          start();,
          join();
          successful = dumpFailures() == 0;
                                            <--- the result is recorded and all memory for stressing can be released
        } catch ...
          ...
      }

      In the denoted line, we don't explicitly clean up test-running related data structures, making the test more vulnurable to OOM after the testing is effectively over.

          private List<Runnable> runnables = new ArrayList<Runnable>();
          private List<ManagedThread> threads = new ArrayList<ManagedThread>();

      These two data structures are no longer needed after `successful = dumpFailures() == 0;`, so we can clear them.

            ayang Albert Yang
            ayang Albert Yang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: