Unlocking circular references (was: loosing memory in compiled code)

Ralf Juengling <[email protected]> Wed, 22 Feb 2006 12:57:50 -0800 (PST)
Newsgroups gmane.lisp.lush.devel
Message-ID <[email protected]>
Okay, I found one locking bug in lisp_c.c, but that occurred in PSU
Lush only (I created it when I made changes to the index C-API that
made changes in lisp_c.c and other modules necessary). Apologies for
the noise. :-/

Turns out that this was not the only locking bug, though. I also
found that the garbage collector cannot purge circular structures,
and I use circular lists frequently in conjunction with mapcar. E.g.:

? (de .cl (&rest items)
     (let ((l items))
       (rplacd (lastcdr l) l)
       l ) )
= t
? (mapcar + (.cl 1) (range 5))
= (2 3 4 5 6)


(in PSU Lush mapcar may be applied to lists with different lengths).

Now, the second argument to mapcar, (.cl 1),  won't be purged because
the garbage collector assumes there is no such thing as circular lists:

? (used)
= 223473
? (list 1 2 3)
= (1 2 3)
? (used)
= 223473
? (.cl 1 2 3)
= (1 2 3 1 2 ...)
? (used)
= 223479


Any ideas on how to fix this?

Ralf













-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642