RFR: 8276990: Memory leak in invoker.c fillInvokeRequest() during JDI operations

Chris Plummer cjplummer at openjdk.java.net
Tue Feb 1 19:29:11 UTC 2022


On Tue, 1 Feb 2022 14:44:43 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> We observe a native memory leak when repeating JDI operations from Eclipse in a debuggee JVM. See bug report for details.
> 
> AFAICT, this happens because we override methodSignature of a possible pre-existing request object. I am not sure if there is a better place to deallocate the signature.
> 
> Also, I am not sure how to make an automated test for this. We (that is, the customer that reported the problem) verified that the memory leak disappears with the fix.

src/jdk.jdwp.agent/share/native/libjdwp/invoker.c line 240:

> 238:     }
> 239:     error = methodSignature(method, NULL, &request->methodSignature,  NULL);
> 240:     if (error != JVMTI_ERROR_NONE) {

Shouldn't this be done when the invoke has completed rather than at the start of the next invoke? Otherwise you potentially have one outstanding allocation for every thread, and you still have a leak when the thread exits.

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

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


More information about the serviceability-dev mailing list