Re: Possible bug in MemoizedSymbol
| Newsgroups | gmane.comp.java.sisc.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Mar 14, 2003 at 02:51:18PM +0100, Andreas Prohaska wrote: > Hi, > > > Were you repeatedly calling eval() or something? If you run > > this code > > in a Scheme loop, you won't be compiling the code over and > > over and thus > > not generating new symbols. Nevertheless... > > > This was just a small test program to do some testing. The real > program is doing more complicated computations that cannot be > done in scheme alone. Right, but you were calling into SISC using the Context/Interpreter, not running code in the REPL, right? > > > > > No, this shouldn't be true. The MemoizedSymbol object itself should > > become unreachable after the expression returns, so it should > > be garbage > > collectable. Once its collected, the string in the > > WeakHashMap should > > be free as well. > > I'm quite sure that the WeakHashMap keeps all entries until the *key* > is no longer referenced. References to the value (MemoizedSymbol in our > case) > don't matter. But since the MemoizedSymbol extends Symbol and this class > stores the value of the Symbol as a String (that is also used as key in the > WeakHashMap) nothing will ever be released. 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. > > > > Were you actually running System.gc() to force collection and still > > noticing the problem? Its possible that the Symbol is > > getting into some toplevel or expander datastructure. > > > > I ran System.gc() several times in the profiler (OptimizeIt) and nothing > happended. I'm going to assemble some profiling output for you during > the weekend. Okay. Scott
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+cegsr9IW4v3mHtQRAskpAJ9MpUNmLfapz27YquA6jogjg3afoQCfeV6O a0LUF139qsI35LKwiU0mlaA= =vDve -----END PGP SIGNATURE-----