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

David Holmes dholmes at openjdk.java.net
Fri Mar 18 01:46:28 UTC 2022


On Tue, 15 Mar 2022 14:56:29 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

> 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.

Okay, this is probably about as bullet-proof as you can make it.

Once [JDK-8282952](https://bugs.openjdk.java.net/browse/JDK-8282952) is fixed this should probably be reverted in 19. It will need modifying once the TG destroy() method is removed anyway.

Thanks,
David

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list