开发者

java store objects that may be garbage collected

开发者 https://www.devze.com 2023-03-14 22:54 出处:网络
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.

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 havi开发者_Python百科ng a hard time finding this. There is so much information about GC in general. Anyone know the name?


I believe you are looking for WeakReference


You're thinking of Weak References.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消