You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gregor Zeitlinger <gr...@zeitlinger.de> on 2006/10/29 17:06:47 UTC

[collections] WeakArrayList

I recently had a severe memory leak because more listeners were added
to a listener list than removed.
I solved the problem by adding only WeakReferences and compacting the
list in a separate thread. CursorableLinkedList has a similar solution
for cursors - except that the cursors are not cleaned up in a separate
thread (which is better, now that I'm thinking about it).

So what I suggest is a list where the entries are stored in weak
references and auto-cleaned like the cursors in CursorableLinkedList.
No more removeListener - which is silly anyways.

-- 
Gregor Zeitlinger
gregor@zeitlinger.de

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org