This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Kawa fails if used in multithreading
On 08/07/2010 01:06 AM, Per Bothner wrote:
So the still-answered question is why the $Lsstring$Gr classes aren't
getting garbage-collected.
More later ...
The problem looks like the 'table' field in gnu.expr.ModuleContext.
This uses a WeakHashMap - but it is well-known that you shouldn't use
a WeakHashMap if there is a strong reference from the value to the key.
And in this case there is: The key is a class, and the value is an
instance of the class, thus the value.getClass() is a strong reference
to the key.
That is the reason I write the AbstractWeakHashTable class, which is
used a couple of places in kawa. I'm testing out replacing the
WeakHashMap with AbstractWeakHashTable, and it seems to be working.
If so, I'll check the change in tomorrow.
--
--Per Bothner
per@bothner.com http://per.bothner.com/