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

Aleksey Shipilev shade at openjdk.org
Tue Oct 28 09:25:13 UTC 2025


On Mon, 27 Oct 2025 19:48:10 GMT, Chad Rakoczy <duke at openjdk.org> wrote:

> [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.

I don't understand this patch. So for release builds, we get stuck at `reference_count=1` and do continuous `os::free(_immutable_data)`? How's that correct?

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

PR Review: https://git.openjdk.org/jdk/pull/28008#pullrequestreview-3387604354


More information about the hotspot-compiler-dev mailing list