You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by robert burrell donkin <ro...@blueyonder.co.uk> on 2003/05/14 20:17:13 UTC

[beanutils] WeakHashMap or ReferenceMAP...?

this is about the replacement of BeanUtils singletons with instances per 
thread context classloader (this will ensure that different web apps 
access different instances). we need to make sure that when the 
classloader (used as the key) is garbage collected, the instance (which is 
the value) is made available for garbage collection.

i've test WeakHashMap on two 1.3 JVMs (macOSX and blackdown linux) and in 
both cases, the entry value is not correctly removed resulting in a memory 
leak. WeakHashMap works the way that we need on the 1.4 linux JVM i use 
(the sun one, i think).

the latest ReferenceMap from commons-collections works the way that we 
need it on all JVMs but this means switching the dependency to the latest 
(unreleased) commons-collections.

so it's  choice between using WeakHashMap in the knowledge that it will 
cause a memory leak on some(?) 1.3 JVMs or using ReferenceMap and 
depending on commons-collections CVS HEAD. comments anyone?

- robert


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