RFR: 8366925: Improper std::nothrow new expression in NativeHeapTrimmerThread ctor

Guanqiang Han ghan at openjdk.org
Mon Sep 15 01:07:54 UTC 2025


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.

-------------

Commit messages:
 - 8366925: Improper std::nothrow new expression in NativeHeapTrimmerThread ctor

Changes: https://git.openjdk.org/jdk/pull/27275/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27275&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366925
  Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/27275.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27275/head:pull/27275

PR: https://git.openjdk.org/jdk/pull/27275


More information about the hotspot-runtime-dev mailing list