[Top][All Lists]

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

Re: Fixing guardians

From: Marius Vollmer
Subject: Re: Fixing guardians
Date: 11 Dec 2000 16:11:38 +0100
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

Michael Livshin <address@hidden> writes:

> > This process should take care of guarded objects referencing other
> > guarded objects and of cycles among guarded objects.  The cycle will
> > be broken at an arbitrary link, but that's OK.
> the point about cycles is actually the only one that I find debatable.
> I (apparently in a fine company of Hans Boehm, Dirk Herrmann and maybe
> others) think that it's preferable to leave cycles "guarded" (not
> "caught", that is) and warn the user about them, because finalizing
> things in some wrong order is worse than not finalizing them at all.
> and breaking cycles is not hard and shouldn't be a frequent need in
> practice anyway.

Yes, I like this better, too.  See below.

> > For example, take two cons cells
> > 
> > [...]
> > 
> > Ok, what's wrong with this simple algorithm?
> nothing, in the acyclic case.

There is a serious bug in my algorithm with cycles like this

    a: ( #f . x)
    x: ( #f . a)
    b: ( #f . x)

a and x form a cycle and b references this cycle at x.  Both a and b
are guarded, but x is not.  When a is encountered before b in the
first guardian phase, x gets marked (which is OK) and a has its mark
bit reset.  Then we encounter b but the marking stops at x because it
is already marked.  We will then erroneously move a to the `caught'

I think we might fix this by noting whether we just have marked a
cycle in the first guardian phase (by using Dirks
scm_gc_mark_successors, say) and spit out the warning and not reset
the mark bits in that case.

But anyway, I now understand that it is more difficult than I
originally thought.

reply via email to

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