On Tue, 25 Jul 2023 21:48:24 GMT, Paul Hohensee <p...@openjdk.org> wrote:
> MonitoringSupport_lock is initialized only when UseG1GC is true, but > [JDK-8304074](https://bugs.openjdk.org/browse/JDK-8304074) uses it to > implement getTotalThreadAllocatedBytes, which is available for all garbage > collectors. While the current code sets UseG1GC regardless of which collector > is specified, see FLAG_SET_ERGO_IF_DEFAULT(UseG1GC, true) in gcConfig.cpp, if > G1 isn't included in the Hotspot build or Hotspot is not running on a server > class machine (unlikely these days), the lock will not be initialized. The > lock's initialization should be unconditional. > > I updated ThreadAllocatedMemory.java to run the test using both G1 and Serial > collectors. Aleksey, no, it doesn't break now because (1) we don't appear to test on non-server class machines, and (2) FLAG_SET_ERGO_IF_DEFAULT sets UseG1GC unconditionally regardless of which GC is specified on the command line because it (UseG1GC) hasn't also been specified on the command line. So, the assert will have no effect. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15028#issuecomment-1651986014