Yikes! I just wrote:
+---------------
| Joe Marshall <jrm@ccs.neu.edu> wrote:
| +---------------
| | Suppose that the system has done a full GC. Now you SETQ *foo* to NIL
| | and perform another full GC. It seems to me that the storage
| | reclaimed is *exactly* the `size' of *foo*.
| +---------------
|
| Careful!! Don't forget the builtin "history" variables in the REPL.
| You probably want to do something like this:
|
| > (gc :full t)
| > (room) ; size while *foo* still holds a reference
| > (setq *foo* nil) ; zap *foo* and * and /
| > (setq *foo* nil) ; zap ** and //
| > (setq *foo* nil) ; zap *** and ///
| > (gc :full t)
| > (room) ; size after *foo* is gone
|
| [I know you know all of this, but CL newbies (such as myself!)
| sometimes overlook it when trying to do GC measurements...]
+---------------
And of course, it just *had* to have a bug, didn't it?!? ;-} ;-}
The REPL variables may have had some big junk in them *before* the
first GC, and therefore the first ROOM may print an overly-large
value. I think you may need something like this instead:
> (setq *** nil /// nil
** nil // nil) ; * and / will be taken care of by this, too.
> (gc :full t) ; values of GC & ROOM not defined, but
; probably safe [NIL, T, (values), etc.]).
> (room) ; size while *foo* still holds a reference
> (setq *foo* nil) ; zap *foo* and * and /
> (gc :full t)
> (room) ; size after *foo* is gone
If you're manually typing this at the REPL, you can't do much about
+++, ++, +, and -, but at least they're known small constants, given
the above forms. [Well, actually you *can*, if you put of all the above
(and a little more) in a function that clears them out, but...]
-Rob
-----
Rob Warnock, PP-ASEL-IA <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607