Hello Geotools developers

We've noticed that running geotools on a java version of 22 or higher causes warning logs to output like:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::invokeCleaner has been called by org.geotools.util.NIOUtilities$CleanupAfterJdk8 (file:/home/glennw/projects/riskscape/riskscape/engine/app/build/install/riskscape/lib/gt-metadata-31.2.jar) WARNING: Please consider reporting this to the maintainers of class org.geotools.util.NIOUtilities$CleanupAfterJdk8
WARNING: sun.misc.Unsafe::invokeCleaner will be removed in a future release

I've created a pull request (https://github.com/geotools/geotools/pull/5695) to add a new memory cleanup method using the MemorySegment api (https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/foreign/MemorySegment.html). The MemorySegment based cleanup will be used if available otherwise it will fall back to use Unsafe.

I think this is the correct way to do this kind of thing now. But I'm not entirely sure as I've never had to worry about releasing memory before the garbage collector gets to it. Can you advise if this is good or not.

We've also considering if we could no-op the cleanup so our users don't see this message. Our application is single user so maybe this wouldn't   I thought setting the system property  ` geotools.nioutilities.direct=false` would prevent this warning but that doesn't seem to be the case.

Regards

Glenn

--
*Glenn Walbran*
Software Developer
*Catalyst.Net Ltd - Expert Open Source Solutions

*Catalyst.Net Ltd - a Catalyst IT group company
Mob: +64 21 211 1301 | www.catalyst.net.nz <http://www.catalyst.net.nz>

Catalyst Logo

CONFIDENTIALITY NOTICE: This email is intended for the named recipients only. It may contain privileged, confidential or copyright information. If you are not the named recipient, any use, reliance upon, disclosure or copying of this email or its attachments is unauthorised. If you have received this email in error, please reply via email or call +64 4 499 2267.**
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to