From: Greg Menke
Subject: Keeping track of scratch symbols so their contents can be freed.
Date: 
Message-ID: <m3ofsd2lqy.fsf@europa.mindspring.com>
Within a package I'm arranging to do some text indexing, I keep
various hash tables and a few lists.  As I've been writing and
debugging, I've accumulated some scratch variables that were used for
testing code snippets that manipulate large portions of the data
contained in the various tables.  The scratch symbols were defined &
set in the top level reader (sorry if I'm misusing words).  Some of
them are holding on to substantial amounts of data that are otherwise
unused & I've since forgotten the particular symbol names.

If I was in-package'd to my package at the time of the symbol
definition & use, I assume delete-package would release them & their
data, which would be fine.  But if I inadvertently created them in
cl-user, are there better recourses than iterating over all the
cl-user symbols just to find my temporary ones?  Exiting & restarting
the environment would work, but thats a drag.

Thanks for any help,

Greg Menke
From: Thomas F. Burdick
Subject: Re: Keeping track of scratch symbols so their contents can be freed.
Date: 
Message-ID: <xcv7kyzap5t.fsf@apocalypse.OCF.Berkeley.EDU>
Greg Menke <··········@mindspring.com> writes:

> Within a package I'm arranging to do some text indexing, I keep
> various hash tables and a few lists.  As I've been writing and
> debugging, I've accumulated some scratch variables that were used for
> testing code snippets that manipulate large portions of the data
> contained in the various tables.  The scratch symbols were defined &
> set in the top level reader (sorry if I'm misusing words).  Some of
> them are holding on to substantial amounts of data that are otherwise
> unused & I've since forgotten the particular symbol names.
> 
> If I was in-package'd to my package at the time of the symbol
> definition & use, I assume delete-package would release them & their
> data, which would be fine.  But if I inadvertently created them in
> cl-user, are there better recourses than iterating over all the
> cl-user symbols just to find my temporary ones?  Exiting & restarting
> the environment would work, but thats a drag.

I don't really see how you could expect to methodically identify your
temporary symbols if you don't leave some sort of hint around.  I
don't tend to run into this as a big problem in CL for some reason,
but after noticing that junk I left in my Emacs image would cause it
to grow obscenely, I started naming all of my temp variables starting
with ">>".  I can then call a utility function I wrote (unintern-junk)
to go unintern all symbols starting with ">>" longer than 2 chars in
length.  It works well enough for me.