Jochen Hoenicke wrote:
> Hello,
>
> I have just committed the jdk 1.2 Reference classes java.lang.ref.
> They don't have any special functionality. This should be AFAIK
> implemented by the garbage collection.
unfortunately, the JDK1.2 Reference classes do a lot more -- they
actually have some code in there.
> This should enable us to implement WeakHashtable (even if it doesn't
> work yet, it will at least compile) and to use References for caches
> (the java.util.ResourceBundle come into my mind).
SoftReferences are better for this. WeakReferences are cleared whenever
they are found to be the only path to an object. SoftReferences are
cleared when memory gets tight.
Chris