[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC and cycle

From: Michael Livshin
Subject: Re: GC and cycle
Date: 16 Apr 2002 20:50:56 +0300
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Copyleft)

Lamy Jean-Baptiste <address@hidden> writes:

> On 2002.04.11 23:12:23 +0200 Michael Livshin wrote:
> > Lamy Jean-Baptiste <address@hidden> writes:
> > 
> > > When using guardian and gc, i get the following message printed :
> > > 
> > > ** WARNING: the following guarded objects were unguarded due to cycles:
> > > #<procedure self args>
> > > 
> > > and the guardian is suddenly emptied... What does that mean ?
> > > ("#<procedure self args>" is the object i've put in the guardian)
> > 
> > didn't it print any more objects?
> No, only one.
> For info, there're only 2 (similar) objects in the guardian. The warning
> occurs when (gc) is called, and after that, both object are
> unguarded !

the defined semantics of guardians is such that guarding objects which
are parts of cycles is not well-defined (I can explain the rationale
for this restriction if you want, but you probably don't :).)

it seems that your procedure references itself somewhere in its code.
thus inroducing a cycle.  *you* may know that it's safe, but the GC
can't know that.

to work around this, don't guard the procedure as is.  wrap it in a
cons pair and guard that instead.

[ sorry for asking irrelevant questions... ]

Debugging? Klingons do not debug. Our software does not coddle the
                                        -- Klingon Programmer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]