RFR: 8297638: Memory leak in case of many started-dead threads
Jaikiran Pai
jpai at openjdk.org
Thu Jan 19 00:51:35 UTC 2023
On Wed, 18 Jan 2023 20:06:33 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.
src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java line 177:
> 175: private void removeUnreachableListeners() {
> 176: boolean found = false;
> 177: while (listenersReferenceQueue.poll() != null) {
Hello Chris, I have no prior knowledge of this code, so this is just a casual observation - should this change here be a `if` instead of a `while`? I see that this `removeUnreachableListeners()` gets called whenever a new listener is being added in `addListener(...)`. With the use of `while`, is this intentionally waiting for the GC to kick in and add at least one reference object to this queue?
-------------
PR: https://git.openjdk.org/jdk/pull/12081
More information about the serviceability-dev
mailing list