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);