RFR: 8336692: Redo fix for JDK-8284620

Vladimir Kozlov kvn at openjdk.org
Thu Jul 18 14:45:02 UTC 2024


[JDK-8284620](https://bugs.openjdk.org/browse/JDK-8284620) tried to fix memory leak for `CodeBuffer::_overflow_arena` but I think the fix was incorrect. It created an issue when CodeBuffer expanded and we try to use information in `CodeBuffer::_overflow_arena` but it will be nulled.

CodeBuffer expansion affect only data (addresses and descriptors) associated with code and data in CodeCache where we create new CodeBlob with bigger space for code. CodeBuffer's data allocated in C heap is not affected and should not be updated.

The original code in [CodeBuffer::take_over_code_from()](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/asm/codeBuffer.cpp#L976) incorrectly copied `_overflow_arena` from [new CodeBuffer `cb`](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/asm/codeBuffer.cpp#L937) where it is NULL and as result we lost pointer to allocated space. Which was the reason for memory leak.

The fix is to remove that old line in `CodeBuffer::take_over_code_from()` and undo JDK-8284620) fix.

Tested tier1-3,stress,xcomp.

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

Commit messages:
 - 8336692: Redo fix for JDK-8284620

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

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


More information about the hotspot-compiler-dev mailing list