RFR: 8282704: runtime/Thread/StopAtExit.java may leak memory

Daniel D.Daugherty dcubed at openjdk.java.net
Tue Mar 15 20:33:09 UTC 2022


Fix memory leak/pinning in runtime/Thread/StopAtExit.java stress test.
Change the test to:
- create and use its own ThreadGroup so it knows the expected thread count
- detect failures to cleanup the ThreadGroup
- these failures to cleanup can occur due to ThreadStop landing during Thread.exit()

The test uses reflection to call the package private ThreadGroup.threadTerminated()
or ThreadGroup.destroy() as needed. Sometimes the manual cleanup is not needed;
in a 30 second run, I typically see between 0-5 manual cleanups on my MBP13.

-------------

Commit messages:
 - Add code to destroy() ThreadGroup when needed.

Changes: https://git.openjdk.java.net/jdk/pull/7819/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7819&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8282704
  Stats: 66 lines in 1 file changed: 63 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7819.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7819/head:pull/7819

PR: https://git.openjdk.java.net/jdk/pull/7819


More information about the hotspot-runtime-dev mailing list