RFR: 8330849: Add test to verify memory usage with recursive locking

Leonid Mesnik lmesnik at openjdk.org
Mon Apr 22 19:53:30 UTC 2024


On Mon, 22 Apr 2024 18:33:11 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> Before recursive support has been added to lightweight locking, using recursive locking patterns would inflate lightweight locks to full monitors. In some scenarios (when churning lots of recursively locked objects), this could lead to excessive native memory usage. I'd like to add a test that verifies that this does not happen.
> 
> I verified that the new test fails reliably with an earlier commit that did not have LW recursive locking, yet, and passes with latest LW recursive locking.

test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java line 57:

> 55:             }
> 56:         } else {
> 57:             ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(

Are there any reasons to use createLimitedTestJavaProcessBuilder here?
If test should work with C1/C2 and different locking modes then it would be better just to use createTestJavaProcessBuilder and don't use 'TieredStopAtLevel'. So the test could be executed with C1/C2, different GC, and any other VM flags.
They should be combined with test vm options.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18899#discussion_r1575286330


More information about the hotspot-runtime-dev mailing list