RFR: 8369219: JNI::RegisterNatives causes a memory leak in CodeCache [v4]
    Francesco Andreuzzi 
    fandreuzzi at openjdk.org
       
    Thu Oct 23 08:25:04 UTC 2025
    
    
  
On Thu, 23 Oct 2025 02:59:05 GMT, Dean Long <dlong at openjdk.org> wrote:
>> I see, I assumed an nmethod couldn't be marked as on-stack without entry barriers, but that doesn't seem to be the case.
>> 
>> But on second thought, do you agree with the fix I'm proposing in this PR? I think the following two work items could be implemented and reviewed in separate changesets:
>> - Allow not-entrant nmethod to be collected during GC (I removed `is_static_method()` from L2599, so native nmethods are treated just like normal nmethods)
>> - Evaluate the implications of removing entry barriers for native nmethods, thus letting GC reclaim them whenever `!is_maybe_on_stack() && is_not_entrant()`, but without the overhead of entry barriers.
>> 
>> I'm proposing this because I guess the latter will need more discussion and is technically not needed to fix the memory leak I address in this PR. Do you agree @dean-long ? I could create another ticket to handle the second item.
>
> Yes, I'm fine with it being a separate issue.
https://bugs.openjdk.org/browse/JDK-8370472
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27742#discussion_r2454316998
    
    
More information about the hotspot-compiler-dev
mailing list