commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [LANG] - suggestions for new Identity Hash code classes
Date Tue, 16 Sep 2008 13:30:57 GMT
On 16/09/2008, Jörg Schaible <Joerg.Schaible@scalaris.com> wrote:
> Hi Simon,
>
>  Simon Kitching wrote:
>  [snip]
>
> > One other concern is regarding garbage collection. From a
>  > brief look at
>  > the code, this thread-local registry object contains a set of Integer
>  > hashcodes. With this change, the set will now contain real hard
>  > references to objects, preventing them from being garbage-collected
>  > while they are in the set. Does this matter?
>
>
> Good catch. I am quite sure this will matter, unfortunately. HashCodeBuilder.reflectionHashCode(Object)
is widely used and if a new lang version suddenly keeps those values, we might prevent redeployments
that worked so far and causing memory leaks. Using a WeakReference instead? We're getting
slow :-/
>
>  - Jörg
>
>  BTW: The current implementation of HashCodeBuilder.reflectionHashCode(Object) is not
wrong, its the class implementation that uses EqualsBuilder.reflectionEquals(o, this) together
with it.

I disagree: the current implementation assumes that it can uniquely
map objects to Integers. This assumption does not depend on the
definition of equals.

> We might therefore also create a new method HashCodeBuilder.reflectionHashCodeRespectingEquals(Object)
...
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

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


Mime
View raw message