Removal of sun.misc.Unsafe in Java 9

84 views
Skip to first unread message

Devosh Mathivanan

unread,
Nov 30, 2015, 6:50:07 AM11/30/15
to kryo-users
Kryo Team,

It seems the package "sun.misc.Unsafe" (kryo uses it for fast serialization/deserialization) is going to be removed in future versions of Java... if there are no altternatives for "sun.misc.Unsafe".. we won't be able to make seamless updates. What's your catch on this update? Will Kryo work on any alternatives?

References:
http://blog.dripstat.com/removal-of-sun-misc-unsafe-a-disaster-in-the-making/
https://docs.google.com/document/d/1GDm_cAxYInmoHMor-AkStzWvwE9pw6tnz_CebJQxuUE/edit?pli=1#heading=h.brct71tr6e13


Regards,
Devosh M

Joachim Durchholz

unread,
Nov 30, 2015, 8:58:13 AM11/30/15
to kryo-...@googlegroups.com
Am 30.11.2015 um 12:50 schrieb Devosh Mathivanan:
> Kryo Team,
>
> It seems the package "sun.misc.Unsafe" (kryo uses it for fast
> serialization/deserialization) is going to be removed in future versions of
> Java... if there are no altternatives for "sun.misc.Unsafe".. we won't be
> able to make seamless updates. What's your catch on this update? Will Kryo
> work on any alternatives?

Well, for completeness, also take a look here:
http://mail.openjdk.java.net/pipermail/openjfx-dev/2015-April/017021.html

So they want private APIs to go away, but they also want to offer
alternatives.

Also, there's
http://mail.openjdk.java.net/pipermail/openjfx-dev/2015-April/017020.html which
essentially says "we plan to allow access to internals anyway with the
proper -XX flag, unless in a context with a security manager". Which I
think is reasonable - Unsafe can be used to circumvent it.

Still, Kryo needs to identify the internal APIs it's using (some
messages mention running jdeps to find that out) and getting into
contact with the jigsaw mailing list to get the use heard, and/or the
Unsafe usage reported in JIRA. Maybe describe the alternate strategies
that Kryo uses and discuss ways to make them as fast as Unsafe.

Regards,
Jo

Eduardo Ostertag

unread,
Apr 16, 2025, 6:53:23 PMApr 16
to kryo-users
Kryo Team,

According to Oracle Java 24 Release Notes, Java 24 will issue a warning message if any memory-access method using sun.misc.Unsafe is invoked.
You can also read "We strongly encourage library developers to migrate from sun.misc.Unsafe to supported replacements, so that..."
My question: Do you have any plans to build a new a Kryo version that will use this new Java API to replace sun.misc.Unsafe?

Thanks in advance,
-Eduardo Ostertag

Thomas Heigl

unread,
Apr 17, 2025, 10:42:20 AMApr 17
to kryo-...@googlegroups.com
Hi Eduardo,

Yes, we eventually plan to release a version of Kryo that has a minimum JDK version of 17 or 21 and replace deprecated APIs where possible. Most likely, this will not happen before Java 25 is released and we know what APIs are still available in this LTS release.

Best,

Thomas

--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/kryo-users/d4c6ff5b-69d9-44b0-82ff-174f9f6d90afn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages