Re: Possible bug in MemoizedSymbol
Scott Miller <[email protected]>
| Newsgroups | gmane.comp.java.sisc.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Mar 14, 2003 at 03:22:12PM +0100, Andreas Prohaska wrote: > > > Yes, but the only place that key exists is in the MemoizedSymbol, so > > when its garbage collected, it should free the WeakHashMap as well. > > Remember, the Java GC can handle circular references like this. > > > > But the MemoizedSymbol is always referenced. WeakHashMaps have strong > references to their value objects. > > Here's the little program I run together with one code example. You have to > change package names a bit if you want to run it. > > BTW, thanks for your fast answers ;-) You're absolutely right. Its a slow leak, but its a leak. I've checked in a fix into CVS, which does the Java APIs suggestion of wrapping the value in a WeakReference. Thanks for the help! Scott
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+cfSEr9IW4v3mHtQRAkAtAJ45BPnIdDANOTJYsQgA7Y+U2WUX5gCgil6h jshbhXZCDuVT7jPSPAZVBqk= =/Fkk -----END PGP SIGNATURE-----