On Tue, 21 Mar 2023 21:38:12 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
> There are two GC related issues with this test that are being addressed. The > test was limiting the heap size to 6m so if there is still a leak, it will be > detected quickly. This proved to be too small of a size when using ZGC. For > the most part changing the size to 7m fixed this issue. However, I was still > seeing frequent issues with ZGC on macOS. This is explained by > [JDK-8304449](https://bugs.openjdk.org/browse/JDK-8304449), which noticed > (rarely) OOME on macos even when not using ZGC. From JDK-8304449: > > "macOS has a thread behavior that is not seen on linux and windows that is > causing more memory usage, which sometimes leads to this unexpected OOME. The > debuggee side of the test constantly creates threads that do little more than > a short sleep. It has a counter of "live" threads, and won't let that go over > 500. On the debugger side it is just tracking ThreadStartEvents and > ThreadDeathEvents. It keep tracks of threads (ThreadReferences) for which a > ThreadStartEvent had been received but a ThreadDeathEvent has not. On linux > and windows the count of outstanding threads is generally in the 200-400 > range, sometimes briefly going over 500. However, on macOS it is closer to > 2400. This means a lot more ThreadReferences being tracked, which means more > memory usage, so sometimes you see an OOME on macOS as a result. " > > The `threads` collection mainly existed just so its size could be used to log > the number of outstanding ThreadDeathEvents. I got rid of the `threads` > collection and instead am just tracking the number of ThreadStartEvents and > ThreadDeathEvents, and computing the difference to get the number of > outstanding ThreadDeathEvents. This pull request has now been integrated. Changeset: 9643f654 Author: Chris Plummer <cjplum...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/9643f654da23cfc336d36385031251d039e0550d Stats: 19 lines in 2 files changed: 0 ins; 9 del; 10 mod 8304436: com/sun/jdi/ThreadMemoryLeakTest.java fails with "OutOfMemoryError: Java heap space" with ZGC 8304449: com/sun/jdi/ThreadMemoryLeakTest.java times out Reviewed-by: lmesnik, dcubed ------------- PR: https://git.openjdk.org/jdk/pull/13130