In Java, I recall there is a way to store objects in a usable format that may be garbage collected. It is some sort of loose reference. If they get garbage collected there is a way to detect and reload.
I'm having a hard time finding this. There is so much information about GC in general. Anyone know the name?
我相信您正在寻找WeakReference
您正在考虑弱引用。
I think you're looking for the *Reference
classes in java.lang.ref
. The ReferenceQueue
class allows you to be notified when a reference is collected.
You might also find FinalizableReference from Google Guava useful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.