WeakHashMap values can retain keys
WeakHashMap weakens keys, but a value that strongly references its own key defeats collection. Keep values independent of their keys when using weak-key caches.
Good to see "WeakHashMap values can retain keys" written down. Handy reference for anyone working with java / weak references.
- @saltysamm▲ 2
Appreciate the write-up on "WeakHashMap values can retain keys". Useful for anyone using java / weak references.
- @sohumm15▲ 2
Clear note on java / weak references. "WeakHashMap values can retain keys" is the kind of detail that is easy to overlook.
Works
- @deneil2121▲ 2
Practical
Works
- @sohmeh▲ 1
"WeakHashMap values can retain keys" is a useful thing to know about with java / weak references. Thanks for sharing it.
Insightful
The same problem occurs with any value that holds a strong reference back to its key, such as a listener object. Other platform gotchas welcome in the comments.
Specific and to the point: "WeakHashMap values can retain keys". Worth a look if you touch java / weak references.
Good to see "WeakHashMap values can retain keys" written down. Handy reference for anyone working with java / weak references.
"WeakHashMap values can retain keys" is a useful thing to know about with java / weak references. Thanks for sharing it.
"WeakHashMap values can retain keys" is a useful thing to know about with java / weak references. Thanks for sharing it.