Skip to content

Any plan to remove Unsafe usage ? #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
counter2015 opened this issue Mar 19, 2025 · 3 comments
Open

Any plan to remove Unsafe usage ? #94

counter2015 opened this issue Mar 19, 2025 · 3 comments

Comments

@counter2015
Copy link

Projects that rely on this library will receive warnings when running in JDK 24 version.

refer: sbt/sbt#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/

@pradn
Copy link

pradn commented Apr 9, 2025

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.

@lizlooney
Copy link

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.

@gzm55
Copy link
Collaborator

gzm55 commented Apr 10, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants