RFR: 8297638: Memory leak in case of many started-dead threads [v2]

Serguei Spitsyn sspitsyn at openjdk.org
Tue Feb 7 02:28:46 UTC 2023


On Thu, 19 Jan 2023 21:59:22 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Fix JDI leak when the debuggee creates a lot of threads, while at the same the debugger is not sending any commands. The lack of commands being sent results in code not being triggered that normally would clear out unreachable listeners and also clear out ObjectReferences queued for disposal.
>
> Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Cleaned up removeUnreachableListeners().

src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java line 184:

> 182:         // We always need to clear the ReferenceQueue
> 183:         while (listenersReferenceQueue.poll() != null)
> 184:             ;

I'm not sure how does this work.
Do we keep polling if there is any reference object in the queue?
Can it be an endless loop? Does the poll() remove the reverence object from the queue?

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

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


More information about the serviceability-dev mailing list