RFR: 8347833: CrashOnOutOfMemory should stop GC threads before HeapDumpOnOutOfMemoryError [v2]
David Holmes
dholmes at openjdk.org
Fri Feb 14 05:40:10 UTC 2025
On Thu, 13 Feb 2025 18:05:21 GMT, Fairoz Matte <fmatte at openjdk.org> wrote:
>> test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryAndCrashOnOutOfMemory.java line 44:
>>
>>> 42: Object[] oa = new Object[Integer.MAX_VALUE];
>>> 43: for(int i = 0; i < oa.length; i++) {
>>> 44: oa[i] = new Object[Integer.MAX_VALUE];
>>
>> This will throw the "VM limit reached" OOME - does that trigger the heapdump etc processing?
>
> I have copied this code from TestHeapDumpOnOutOfMemoryError.java, and I have restricted heap to -Xmx128M to force OOM in heap.
The heap size will make no difference as you are trying to create an array that is larger than the VM allows. Line 42 will throw OOME and the for loop is never reached.
| Welcome to JShell -- Version 23
| For an introduction type: /help intro
jshell> Object[] oa = new Object[Integer.MAX_VALUE];
| Exception java.lang.OutOfMemoryError: Requested array size exceeds VM limit
| at (#1:1)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23519#discussion_r1955584612
More information about the hotspot-dev
mailing list