Subject: Re: Extending STRING Class
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 21 Aug 2008 10:29:52 -0500
Newsgroups: comp.lang.lisp
Message-ID: <DoKdnRGfadRtFDDVnZ2dnUVZ_jSdnZ2d@speakeasy.net>
Volkan YAZICI  <volkan.yazici@gmail.com> wrote:
+---------------
| p...@informatimago.com (Pascal J. Bourguignon) wrote:
| > (defmethod free ((self string))
| >    (remhash self *subseqs-of-string-map*)
| >    self)
| 
| Hrm... I see. That's fine too. But AFAIK, there is no FREE in ANSI CL.
| Am I mistaken? How is FREE supposed to work?
+---------------

All it does it remove the argument from the hash table, thus
removing the reference to the argument *by* the hash table that
would prevent it from being GC'd. [There may still be *other*
references to the object in your code; it's up to you to remove
or overwrite those.]

You are correct that there is no built-in FREE in CL. But
all you have to do in CL to "free" an object is remove *all*
references to the object [turning it into "garbage"], and
the GC will (eventually) come along and discover the lack of
any such references and collect the space used by the object.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607