RFR: 8279949: JavaThread::_free_handle_block leaks native memory

David Holmes dholmes at openjdk.java.net
Sun Feb 13 02:19:05 UTC 2022


On Sun, 13 Feb 2022 02:05:04 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Please review following fix which delete whole list of JNIHandle blocks in JNIHandleBlock::release_block(...).
>> Also, I added sanity verification of _pop_frame_link to ensure that there are no leaks there.
>> 
>> Fix verified with tier1-6. Also, verified that memory leak is not reproduced anymore.
>> 
>> Thanks to Vladimir I.  for finding exact root cause of problem.
>
> src/hotspot/share/runtime/jniHandles.cpp line 395:
> 
>> 393:       delete block;
>> 394:       block = next;
>> 395:     }
> 
> Given the comment below about the `pop_frame_link`, I'm concerned that it may be possible that the loop above has deleted the block that `pop_frame_link` refers to. AFAICS we should only have a chain above if we have unbalanced `pushLocalFrame`/`popLocalFrame`, but that is the case the following code is trying to deal with too.

I see the bug report indicates the problem is with a chain of blocks in the free-list - something which again seems to indicate unbalanced use. But the fix doesn't just change the free-list handling, it also changes the active-list handling.

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

PR: https://git.openjdk.java.net/jdk/pull/7453


More information about the hotspot-runtime-dev mailing list