Overview The java.lang.ref package provides more flexible types of references than are otherwise available, permitting limited interaction between the application and the Java Virtual Machine (JVM) garbage collector. It is an important package, centr…
Java中的Reference对象和GC是紧密联系在一起的,Reference的实现也是和GC相关的. 强引用 强引用是Java中使用最普遍的引用,我们经常使用的Object o = new Object(),这里的o就是强引用.如果一个对象具有强引用,那么GC是一定不会回收这个引用的,它宁愿抛出OutOfMemeryError,也不会随意回收具有强引用的对象. 软引用 软引用(SoftReference)在Java中通常用作内存敏感的Cache.被软引用引用的对象,当没有其他强引用存在时,GC…
public class WeakReference<T> extends Reference<T> { public WeakReference(T referent) { super(referent); } public WeakReference(T referent, ReferenceQueue<? super T> q) { super(referent, q); } } public abstract class Reference<T> {…
reference:http://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/Map/skip-list-impl.html The link list element structure used to implement a Skip List The link list element used to implement the skip list has 4 links (not including the data portion…