Zero-Allocation-Hashing
Zero-Allocation-Hashing copied to clipboard
Any plan to remove `Unsafe` usage ?
Projects that rely on this library will receive warnings when running in JDK 24 version.
refer: https://github.com/sbt/sbt/issues/8073
WARNING: Please consider reporting this to the maintainers of class net.openhft.hashing.UnsafeAccess
WARNING: sun.misc.Unsafe::arrayBaseOffset will be removed in a future release
WARNING: A restricted method in java.lang.System has been called
Is there any plan to remove Unsafe usage?
see also: https://foojay.io/today/unsafe-is-finally-going-away-embracing-safer-memory-access-with-jep-471/
A major user of this library is parquet-java, see related issue. I hope the issue can be solved in this repo by the Zero-Allocation-Hashing maintainers.
The memory access APIs in sun.misc.Unsafe were deprecated in JDK 23. They are scheduled to be REMOVED from the JDK after JDK 26.
VarHandle was discussed and profiled in #67 and the results are different on environments. This unsafe functions called by this project are pluggable behind Access interface.
We could have two implementations, UnsafeAccess and VarHandleAccess. In building stage, use an separated module for UnsafeAccess to build with JDK<23. In the runtime, select a proper access instance based on the running JDK/JRE or the user configs.