An Oracle blog about Transactional locks

Do you use sun.misc.Unsafe ?

Dave Dice
Senior Research Scientist

Take the following survey on API usage to help JDK planning. (Yes, we're not supposed to use it directly. Caveat Utor. But many folks do, including myself.)

Join the discussion

Comments ( 7 )
  • Thomas Gil Sunday, January 26, 2014

    Yes, I do, to implement a better serialization framework. I also think of relying on it to access some off heap memory

  • guest Sunday, January 26, 2014

    Hi Thomas, make sure to take the survey to make your position known. Personally (and I'm not speaking for Oracle in this context), I'd like to see unsafe remain accessible in its current form so that sophisticated users can continue to make good use of it.

    Regards, -Dave

  • guest Tuesday, January 28, 2014

    Yes, I do use it for performance when serializing objects. What I understand from my conversations with fellow developers is that if anybody actually uses Unsafe it is for serialization.

  • guest Tuesday, January 28, 2014

    Yes I've used it before when working with OpenGL native interop to manage a large number of floats

  • Charles Oliver Nutter Tuesday, January 28, 2014

    FWIW, on the JRuby project we have been using a "mock" Unsafe to allow compiling in newer features. We then choose whether to use those features based on JVM version at runtime, rather than anchoring our codebase to the lowest common denominator.

    See https://github.com/headius/unsafe-mock

  • Christoph Engelbert Wednesday, January 29, 2014

    Hey Dave,

    I hope there is a chance to see the surveys results afterwards. It would be awesomely interesting to see what and how others are using sun.misc.Unsafe.



  • guest Wednesday, January 29, 2014

    Hi Chris,

    I agree - it'd be interesting to see the span and relative frequency of the use cases. I'll try to prod the owner of the survey to make the results known.



Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.