Java ReferenceQueue and garbage collection

17 hours ago 3
ARTICLE AD BOX

The documentation for SoftReference states that

All soft references are guaranteed to be cleared before the virtual machine throws an OutOfMemoryError

This is only sensible, but on all occasions I needed the Reference API, I needed to plug into a ReferenceQueue (or use Cleaner, which is the same). The algorithm polling a queue possibly might free some memory. Is there even a way to somehow inform the GC that it might happen, or at least do it in a way that minimizes the chances of a preventable OOME happening?

Read Entire Article