guile-user
[Top][All Lists]
Advanced

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

Re: Help needed debugging segfault with Guile 1.8.7


From: Neil Jerram
Subject: Re: Help needed debugging segfault with Guile 1.8.7
Date: Sun, 28 Nov 2010 11:38:33 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi Peter,

Thanks for providing such a clear explanation of the problem.  Here are
a few comments.

Peter Brett <address@hidden> writes:

> Sure.  libgeda uses direct management of memory, and the structures used
> in its document object model need to be explicitly deleted when finished
> with.  I decided to use a Guile smob to represent these structures for
> access from Scheme code, with the pointer to the actual structure in
> SCM_SMOB_DATA and with the low nibble of SCM_SMOB_FLAGS indicating which
> type of DOM structure the smob references.
>
> This would have been sufficient if Scheme code had only been working
> with libgeda DOMs created and managed entirely via Scheme code. [...]

I think your design is similar to what is outlined in the `Extending
Dia' node of the Guile manual.  Were you aware of that doc before
working out your design?  If not, I guess we need to make it more
prominent.  If yes, I'd appreciate any suggestions you have for how it
may be improved.

> So, where was the bug?  When a smob is GC'd, and if the pointer it
> contains hasn't already been cleared, [...]

Now that you've successfully debugged this, is there any general advice
that you would offer for "how to investigate a free list corruption?"  I
would guess not, as corruption is fundamentally a general thing and
has infinite possible causes - but perhaps I'm missing something.

> I hope that explained things reasonably precisely!

Thank you, it certainly did.  To conclude, I'll just note that in the
Guile 2.0 future we won't have such difficult problems, because of using
libgc - which will automatically find active references anywhere in the
whole application.  (And of course I understand that your code still
needs to work with Guile 1.8.x now.)

Regards,
        Neil



reply via email to

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