RFR: 8373022: Increase initial heap size for test which assumes no GC

Chris Plummer cjplummer at openjdk.org
Thu Dec 4 16:57:25 UTC 2025


On Thu, 4 Dec 2025 16:17:27 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:

>> test/jdk/com/sun/jdi/MethodInvokeWithTraceOnTest.java line 32:
>> 
>>> 30:  * @run build TestScaffold VMConnection TargetListener TargetAdapter
>>> 31:  * @run compile -g MethodInvokeWithTraceOnTest.java
>>> 32:  * @run driver MethodInvokeWithTraceOnTest -XX:InitialHeapSize=100M
>> 
>> Are you seeing failures due to an ObjectCollectionException? If so, avoiding GC is not the proper way to fix it. Even with a larger initial heap, there can still be an object collected with ZGC. We shouldn't have any debugger tests that rely on a GC not happening in the debugee. The proper fix is usually calling ObjectReference.disableCollection(), although sometimes even that is not enough (the call can happen too late if the debugee is not suspended).
>
> Yes, we're seeing a failure due to ObjectCollectionException. This is because the heap size is now much smaller, causing more frequent GCs. "Reverting" to a larger initial heap size is a straightforward fix so that we can continue running this test.
> 
> I think a more "robust" approach is better, which we could do in a follow-up.

Can you tell me how to run this test with a small GC that reproduces the ObjectCollectionException?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28637#discussion_r2589852760


More information about the serviceability-dev mailing list