Menu

#6 LRUCache.clearAll() memory leak & listener bug

open
nobody
None
5
2005-06-12
2005-06-12
Anonymous
No

If you ever clearAll() using an LRUCache it will create
a new map for the cache, but it doesn't properly set
both internal references to the map. This has the
effect of keeping both the old map and the new map in
memory.

Also the listener interface is never reset to the new
map so any consumers of that interface will be broken.
For example HybridCache uses that listener interface
to move entries into the AutoCache once they fall off
the LRU cache. After the first clearAll this
functionality will be broken.

Quick fix is to simply change method do do map.clear();
instead of creating a new cache reference.

Discussion


Log in to post a comment.