Softly reachable: an object that is not strongly reachable and can be accessed through a soft reference.
软可及对象(softlyreachable):不是强可及对象,并且能够通过软引用访问的对象。
We can fix the problems in LeakyChecksum by using a soft reference to manage the cached buffer, as shown in Listing 2.
通过使用一个软引用来管理高速缓存的缓冲区,可以解决LeakyChecksum中的问题,如清单2所示。
CachingChecksum used a soft reference to cache a single object and let the JVM handle the details of when to evict the object from the cache.
CachingChecksum使用一个软引用来缓存单个对象,并让JVM处理从缓存中取走对象时的细节。
Just as with weak references, a soft reference can be created with an associated reference queue, and the reference is enqueued when it is cleared by the garbage collector.
正如弱引用一样,软引用也可创建为具有一个相关的引用队列,引用在被垃圾收集器清除时进入队列。
From above shall we say that an object can't have a soft reference and a weak reference at the same time?
从以上是否能看出,一个对象不能同时具有软引用和弱引用?
Soft Reference . When an object holds only soft references, GC collects it only if there is not enough memory.
软引用 。当一个对象只具有软引用时,垃圾回收器只在内存不足的时候才回收它。
Soft Reference . When an object holds only soft references, GC collects it only if there is not enough memory.
软引用 。当一个对象只具有软引用时,垃圾回收器只在内存不足的时候才回收它。
应用推荐