RFR: 8347833: CrashOnOutOfMemory should stop GC threads before HeapDumpOnOutOfMemoryError [v2]
Fairoz Matte
fmatte at openjdk.org
Sat Feb 15 01:23:19 UTC 2025
On Fri, 14 Feb 2025 05:37:51 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> 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)
I also observed that in Jshell gives `Requested array size exceeds VM limit` , but during program execution, it gets into this
`STDERR:
stdout: [java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid238354.hprof ...
Heap dump file created [187789641 bytes in 0.285 secs]
Aborting due to java.lang.OutOfMemoryError: Java heap space
`
Based on this assumption only below test are defined.
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpPath.java
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/runtime/ErrorHandling/TestGZippedHeapDumpOnOutOfMemoryError.java
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23519#discussion_r1956972090
More information about the hotspot-dev
mailing list