> Hi, I would like an explanation on how this leaks. Because I obviously tried
> to make it not leak, so just your comment "This will still leak" does not cut
> it.

Of course. I had only a few minutes online to write the mail, my apologises.

While the key and value will be garbage collected the Map.Entry<K,V> will not.

Changing the Entry's key and value to null is not enough to remove it from the 
Map. You must explicitly call
map.remove(K)

This is what the ReferenceMap does through a ReferenceQueue. The implementation 
allows the ReferenceQueue to run in
the foreground or in the background depending on your threading needs (ie to 
match the implementation of map that is
passed into the ReferenceMap's constructor).

~mck
_______________________________________________
Kernel-development mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-development

Reply via email to