RFR: 8370527: Memory leak after 8316694: Implement relocation of nmethod within CodeCache [v3]

Chad Rakoczy duke at openjdk.org
Tue Oct 28 21:05:28 UTC 2025


> [JDK-8370527](https://bugs.openjdk.org/browse/JDK-8370527)
> 
> [JDK-8316694](https://bugs.openjdk.org/browse/JDK-8316694) introduced an `immutable_data_references_counter` which keeps track of the number of nmethods using the immutable data so it can be shared between relocated nmethods. The old code reads the counter, decrements the counter, and then checks the first read to see if it is zero. Since the check is performed on the initial read it will never be zero which causes immutable data to never be freed.

Chad Rakoczy has updated the pull request incrementally with two additional commits since the last revision:

 - Update NMethod.java for parity
 - Add functions to inc or dec ref count

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28008/files
  - new: https://git.openjdk.org/jdk/pull/28008/files/60de0f94..b441dc24

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28008&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28008&range=01-02

  Stats: 105 lines in 3 files changed: 28 ins; 9 del; 68 mod
  Patch: https://git.openjdk.org/jdk/pull/28008.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28008/head:pull/28008

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


More information about the hotspot-compiler-dev mailing list