Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4429536
Votes 3
Synopsis (coll) WeakHashMap limitation: values refer to keys
Category java:classes_util
Reported Against 1.3
Release Fixed
State 6-Fix Understood, request for enhancement
Priority: 4-Low
Related Bugs 4630118 , 6389107 , 6423502 , 5054114
Submit Date 23-MAR-2001
Description




java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


The WeakHashMap is documented as having a minor defect. When values refer to
their own keys, the keys are strongly referenced, defeating the purpose of the
WeakHashMap. I have been burned by this on several occasions. I wasn't aware
that the values were indirectly referencing the keys.

Although the docs indicate that this defect might be fixed in a future release,
it would be nice if an official report was in the bug parade. I'd also like to
know if anyone has any ideas on how this defect can be fixed. I've been studing
the references API, and I can't see any solution.
(Review ID: 119340) 
======================================================================
Work Around
N/A
Evaluation
This will be fixed if/when 4630118 is fixed.  --   xxxxx@xxxxx   2002/12/16
Comments
  
  Include a link with my name & email   

Submitted On 09-APR-2002
lmarco
I have experienced the same problem, by writing a caching
system for avoiding a bigger memory leak results in a
smaller one! The keys keep being strongly referenced ...


Submitted On 02-JAN-2007
greggwon
This is an important issue to resolve.  Some of the more advanced caching strategies need WeakHashMap, and having to manage this issue literally in code is fraught with problems.



PLEASE NOTE: JDK6 is formerly known as Project Mustang