From 83d0bd85afaf1b5724c12f4d2f6e9c7087bab4e8 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Tue, 29 Apr 2025 23:44:45 +0000 Subject: [PATCH] 8355069: Allocation::check_out_of_memory() should support CheckUnhandledOops mode Reviewed-by: sspitsyn --- src/hotspot/share/gc/shared/memAllocator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hotspot/share/gc/shared/memAllocator.cpp b/src/hotspot/share/gc/shared/memAllocator.cpp index 09ac5d25f86..a8ba2074cd1 100644 --- a/src/hotspot/share/gc/shared/memAllocator.cpp +++ b/src/hotspot/share/gc/shared/memAllocator.cpp @@ -126,6 +126,10 @@ bool MemAllocator::Allocation::check_out_of_memory() { // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support report_java_out_of_memory(message); if (JvmtiExport::should_post_resource_exhausted()) { +#ifdef CHECK_UNHANDLED_OOPS + // obj is null, no need to handle, but CheckUnhandledOops is not aware about null + THREAD->allow_unhandled_oop(_obj_ptr); +#endif // CHECK_UNHANDLED_OOPS JvmtiExport::post_resource_exhausted( JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP, message);