Deallocate direct NIO buffers

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Aug 5 05:33:08 UTC 2016


Julien,

There is a public API replacement for sun.misc.Cleaner in 9: 
java.lang.ref.Cleaner [1]

Best regards,
Vladimir Ivanov

[1] https://bugs.openjdk.java.net/browse/JDK-8138696

On 8/4/16 5:09 AM, Julien Gouesse wrote:
> Hi
> The class sun.misc.Cleaner was moved into the package jdk.internal.ref in the module jdk.unsupported and I have to use a command line switch or another mean to add an export to this module to avoid getting a java.lang.reflect.InaccessibleObjectException. I could use a NativeScope in a source code compatible with Java 1.9 and later but I need to find a solution working both with Java 1.8 and Java 1.9. Christoph Engelbert mentioned the class AutoCleaning here:http://www.slideshare.net/ChristophEngelbert/a-postapocalyptic-sunmiscunsafe-world#94What is the right way to release the native memory allocated by a direct NIO buffer without using any internal API in Java 1.9 and later? I need an explicit mechanism that calls Cleaner.clean() somehow. In which package can I find the class AutoCleaning? Best regards.
>


More information about the panama-dev mailing list