unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: out-of-order GC
Date: 31 Dec 2002 20:13:34 +0000	[thread overview]
Message-ID: <m3smwendzl.fsf@laruns.ossau.uklinux.net> (raw)
In-Reply-To: <Pine.LNX.4.30.0212301503420.1884-100000@urd.norna.redhog.org>

>>>>> "Egil" == Egil Moeller <redhog@redhog.org> writes:

    Egil> The problem thus never araised when there was a referense to
    Egil> the transaction-SMOB, only when there where no reference to
    Egil> neither one any more...

This is identical to the problem that I had in guile-xlib (with
connection -> Display and transaction -> window/pixmap/whatever).
Here is the relevant comment from xlib.c...

/* Note on garbage collection and freeing of X resources.

   The one wrinkle in implementing automatic freeing of X resources is
   that almost all X resources depend on a valid display, so we have
   to be careful that the display resource is always freed (using
   XCloseDisplay) last of all.

   In most cases this is handled by having resource smobs include a
   reference to the display smob.  But there is still a problem when
   all remaining X resource references are dropped between one GC
   cycle and the next: when this happens, the next GC sweep could free
   the display smob before it gets to some of the other resource
   smobs.

   Fortunately, resource smobs can check, in their free functions,
   whether this has happened, by looking at the SCM_TYP16 of their
   reference to the display smob.  If the display smob is still valid,
   this will be scm_tc16_xdisplay, and the relevant X resource should
   be freed as normal.  If the display smob has been freed earlier in
   this sweep, GC will have set its SCM_TYP16 to scm_tc_free_cell;
   this indicates that XCloseDisplay has already been called, and so
   the relevant X resource no longer needs to be freed. */

Regards,
        Neil



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  parent reply	other threads:[~2002-12-31 20:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-29 16:36 out-of-order GC Egil Moeller
2002-12-30 13:36 ` Greg Troxel
2002-12-30 14:05   ` Egil Moeller
2002-12-31  3:06     ` Matt Hellige
2002-12-31 20:13     ` Neil Jerram [this message]
2003-01-01 10:57       ` Egil Moeller
2003-01-01 17:58         ` Neil Jerram
2003-01-01 21:22         ` Marius Vollmer

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=m3smwendzl.fsf@laruns.ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    /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).