RFR: 8324657: Intermittent OOME on exception message create

Roger Riggs rriggs at openjdk.org
Wed Jan 24 20:16:45 UTC 2024


When an exception handler for an OutOfMemoryError uses string concatenation to compose an exception message, the invoke dynamic string format implementation may itself exhaust memory, preventing the exception from being handled.
Explicit use of String.concat() call can improve exception handling.

Writing a test of the exact failure condition has proved challenging due to the unpredictable state of memory when OOME occurs. The replacement of "+" with String.concat() is simple and direct.

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

Commit messages:
 - More discriptive comment
 - When handling an OutOfMemoryError due to off-heap allocation failure

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

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


More information about the core-libs-dev mailing list