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

Aleksey Shipilev shade at openjdk.org
Wed Oct 29 09:27:42 UTC 2025


On Wed, 29 Oct 2025 01:26:43 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.
>
> Chad Rakoczy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add include to fix build issue

Looks reasonable to me, thanks. FWIW, I was happy with the (simpler) previous version of the patch, and was content with doing this refactoring later. Maybe split them out, if you want to spend more time on this?

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

Marked as reviewed by shade (Reviewer).

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


More information about the hotspot-compiler-dev mailing list