RFR: 8366925: Improper std::nothrow new expression in NativeHeapTrimmerThread ctor [v2]
David Holmes
dholmes at openjdk.org
Tue Sep 16 03:23:19 UTC 2025
On Tue, 16 Sep 2025 01:00:01 GMT, Guanqiang Han <ghan at openjdk.org> wrote:
>> Please review this Patch.
>>
>> **Description:**
>> Add null check for _lock in NativeHeapTrimmerThread constructor. If allocation of the lock fails (_lock == nullptr), it indicates an out-of-memory condition. Since even this small allocation failed, it's unlikely that subsequent operations would succeed, so we terminate the JVM immediately.
>
> Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:
>
> Update trimNativeHeap.cpp
>
> remove std::nothrow and rely on the default new handling
So we will now abort the VM if the allocation of the monitor fails. That seems okay as we are late in the VM initialization process and so if we have exhausted memory we are not going much further. regardless.
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27275#pullrequestreview-3226938193
More information about the hotspot-runtime-dev
mailing list