commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: [collections] ReferenceMap changed for WeakIdentityMap but now broken
Date Sun, 28 Mar 2004 19:50:07 GMT
Janek Bogucki wrote:
> On Wed, 2004-03-24 at 21:57, Janek Bogucki wrote:
>>At the end there is this which you did not mention in your original post
>>so it might be new information
>>    [junit] Testcase: testPurgeValues took 4.903 sec
>>    [junit]     Caused an ERROR
>>    [junit] null
>>    [junit] java.lang.OutOfMemoryError
>>    [junit]     <<no stack trace available>>
>>    [junit] Testcase: testPurgeValues
> I now realize that this is actually how the test is intended to work.
> Sorry for the noise.

It looks to me as though the intention would be to fail with
"Max iterations reached before resource released"  which happens if you 
decrease the bound on the loop to, say 20. This should probably be changed.

The null test that is failing is

valueReference.get() == null

I have not fully grokked the code, so the following is speculation, but 
might be helpful.

The test setup is

WeakReference keyReference = new WeakReference(key);
WeakReference valueReference = new WeakReference(value);

Map testMap = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);

so the valueReference release has to be triggered by releasing the key 
reference, but in ReferenceEntry.purge(ref), there is no check for 


> -Janek
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message