RFR: 8258077: Using -Xcheck:jni can lead to a double-free after JDK-8193234
Mauro Lacy
github.com+11656534+maurolacy at openjdk.java.net
Fri Dec 11 07:22:07 UTC 2020
On Fri, 11 Dec 2020 06:45:09 GMT, Mauro Lacy <github.com+11656534+maurolacy at openjdk.org> wrote:
>> I've filed: https://bugs.openjdk.java.net/browse/JDK-8258077
>>
>> Cheers,
>> David
>
> Hi David,
>
> Thanks for the issue, I'll change the title to properly reference it.
>
> The point is that I couldn't find those memory leaks. At least in the openjdk code base, I couldn't find tests for that functionality, so, no memory leaks.
>
> And, in any case, if there are tests in another code base, they are leaking because they are incorrect (IMO). In that they are not always following the right calling pattern for `ReleasePrimitiveArrayCritical`.
>
> `ReleasePrimitiveArrayCritical`, despite its name (and to the best of our knowledge), does **not** release the buffer when called with `JNI_COMMIT`. So, it must be called again with a different release mode, to properly release the buffer.
>
> And this, independently of the JVM flags. Or, it will manifest inconsistent behaviour; which is what's happening.
issue 8258077: Using -Xcheck:jni can lead to a double-free after JDK-8193234
-------------
PR: https://git.openjdk.java.net/jdk/pull/1697
More information about the hotspot-dev
mailing list