Possible bug in MemoizedSymbol
Andreas Prohaska <[email protected]>
| Newsgroups | gmane.comp.java.sisc.devel |
|---|---|
| Message-ID | <[email protected]> |
I think, I have found a memory leak in the MemoizedSymbol implementation.
However, I'm not too familiar with SISC so I may be wrong. This is what
I have done:
I run a small scheme code like '(let ((a 1)) (+ a a))' in a single Context
for about 1000 times. It seems to me like the 'let' creates a kind of
naming context for all variables (e.g. 'a') created inside and stores
these variables as MemoizedSymbols (e.g. 'a_FooBarWhatEver'). These
MemoizedSymbols are stored in a static WeakHashMap with their names
(e.g. 'a_FooBarWhatEver') as key.
Now the Java String 'a_FooBarWhatEver' is used as the value of the
MemoizedSymbol (in the Symbol superclass) *AND* as a key in a
WeakHashMap. It's my understanding that under these circumstances, the
MemoizedSymbol will NEVER be removed from the WeakHashMap since the String
is always referenced (because of the way String instances are represented
in a virtual machine). And this is also what my profiler shows. The number
of MemoizedSymbol objects increases even if the AppContext is released and
the garbage collector is run.
Am I right?
Andreas
------------------------------------------------------------------------------
Andreas Prohaska Mail: [email protected]
Apeiron GmbH WWW: http://www.apeiron.de
Hohenzollernstr. 81 - 80796 Muenchen
Tel.: +49 / 89 2782-5740 Fax: +49 / 89 2782-5749
------------------------------------------------------------------------------
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en