unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: Peter Brett <peter@peter-b.co.uk>
Cc: guile-user@gnu.org, geda-dev@seul.org
Subject: Re: Help needed debugging segfault with Guile 1.8.7
Date: Sun, 28 Nov 2010 11:38:33 +0000	[thread overview]
Message-ID: <8739ql38pe.fsf@ossau.uklinux.net> (raw)
In-Reply-To: we1mwroklz34.fsf@ssclt001.eps.surrey.ac.uk

Hi Peter,

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

Peter Brett <peter@peter-b.co.uk> 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	other threads:[~2010-11-28 11:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 12:43 Help needed debugging segfault with Guile 1.8.7 Peter TB Brett
2010-11-10 21:35 ` Peter TB Brett
2010-11-11 10:52   ` Peter Brett
2010-11-11 12:37     ` Thien-Thi Nguyen
2010-11-11 14:22       ` Peter Brett
2010-11-28 11:38         ` Neil Jerram [this message]
2010-11-28 17:21           ` Linas Vepstas
2010-11-30 19:56             ` Peter TB Brett
2010-12-01 19:48               ` Andy Wingo
2010-11-30 19:43           ` Peter TB Brett
2010-12-01 13:46             ` Ludovic Courtès
2010-12-03  7:52               ` Peter TB Brett
2010-11-11  8:22 ` rixed
2010-11-11  8:33 ` Neil Jerram
2010-11-11 13:30 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8739ql38pe.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=geda-dev@seul.org \
    --cc=guile-user@gnu.org \
    --cc=peter@peter-b.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).