2016 年文章归档
共 1 篇文章
Unsafe使用初探
在jdk源码中,经常能够看到sun.misc.Unsafe的使用,通过Unsafe可以操作内存管理等相关操作。 1.怎么使用Unsafe? public final class Unsafe{ private static final Unsafe theUnsafe; private Unsafe(){} public static Unsafe getUnsafe(){ Class cc = sun.reflect.Reflection.getCallerClass(2); if (cc.getClassLoader() != null) throw new SecurityExcept…
2016-07-10 23:40 · 性能