unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: BDW-GC-Guile incompatibilities
Date: Wed, 18 Feb 2009 23:50:33 +0100	[thread overview]
Message-ID: <873adx1f9i.fsf@gnu.org> (raw)
In-Reply-To: 87vdrwl92w.fsf@arudy.ossau.uklinux.net

Hi Neil,

Neil Jerram <neil@ossau.uklinux.net> writes:

> Sorry for my delay in following up here...

Same for me!

>>>>  1. The lack of `gc-live-object-stats'.

> I was actually thinking of decrementing an object type counter when an
> object is collected - and having looked more at the docs I see that
> that would mean using GC_register_finalizer ().  However I also see
> from [1] that that (having most SCM objects being finalizable) would
> be very bad for the effectiveness of the GC - because of the point
> that in a chain of finalizable objects, only one object (the head) is
> finalized in each collection.

Yes, finalization should be used sparsely.

> Ultimately I think `gc-live-object-stats' can be sacrificed if need
> be.  If there are specific application needs for part of the
> information that it provides, I would guess that they are actually for
> specific object types only and could be met by using a guardian.

Yes, that's right.  It's just less convenient, especially when searching
for a leak of unknown origin.

>>>>  3. Different behavior of weak hash tables, see
>>>>     http://lists.gnu.org/archive/html/guile-devel/2008-11/msg00015.html .
>>>>     This can be fixed, but I'm unclear whether it's worth it (comments
>>>>     welcome!).

> Yes, but at least it is a change that we can document, and we can
> precisely advise application authors what they need to do if they see
> this problem.

Right, this may be acceptable.

> Thanks for the detailed description.  But this case could also be solved
> by making scm_stand_in_procs doubly weak, can't it?

Yes (there are doubly-weak tests in `weaks.test').

> (Also, I wonder if it could be solved by getting rid of the stand-in
> thing.  Why does eval-closure need 2 references to module?  Sounds
> like it might be a case of design rot.)

Indeed, there may be room for improvement here.  :-)

> Finally, another concern from [1] is "Cycles involving one or more
> finalizable objects are never finalized."  Given that, can our
> guardians still work?  You mentioned in another email about "possible
> guardian glitches", is this what you had in mind?

What I had in mind is the various tests in `guardians.test' that end up
being "unresolved" (see, e.g.,
http://autobuild.josefsson.org/guile/log-200902271203718687000.txt).  On
my machine I was actually seeing more of them.

The issue is that these tests never fail, they just throw `unresolved'
at worst.  This is due to the fact that we use a conservative GC so if
an object remains alive, it can be due to the fact that a stale
reference to the object is visible on the stack, for instance.

I investigated these `unresolved' test cases, which led to this patch:

  http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commitdiff;h=6a7489ace3f07a8d190110cd1244963526c65729

In most cases, the tests can be made to succeed instead of being
unresolved by changing the code in a way that increases chances that
no references to the object we expect to die are left on the stack.

However, the "g2-garbage saved" is clearly a bug, as explained in the
commit above.  OTOH, this use case is probably not representative of any
real-world application, so I wouldn't worry about it.

Besides, it would be possible for an application to create a cycle of
guardians, which would prevent them from being GC'd, as you noted.
Similarly, an application could create mutually referenced SMOBs, both
of which have a `free ()' procedure; these could not be GC'd either.
But again, that sounds rather unrealistic IMO.  What do you think?

Thanks,
Ludo'.





  reply	other threads:[~2009-02-18 22:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-03 18:38 Plan for 2.0 Neil Jerram
2009-01-04 15:35 ` David Séverin
2009-01-04 16:25   ` Neil Jerram
2009-01-05 13:47     ` Neil Jerram
2009-01-05 15:21     ` David Séverin
2009-01-07 23:18       ` Neil Jerram
2009-01-04 16:27 ` Andy Wingo
2009-01-05  0:50 ` Greg Troxel
2009-01-05 17:21 ` Ludovic Courtès
2009-01-07 23:22   ` Neil Jerram
2009-01-08 13:48     ` Ludovic Courtès
2009-01-16  0:25   ` Neil Jerram
2009-01-17 23:05     ` BDW-GC-Guile incompatibilities Ludovic Courtès
2009-01-30 22:31       ` Neil Jerram
2009-02-18 22:50         ` Ludovic Courtès [this message]
2009-01-17 23:08     ` Plan for 2.0 Ludovic Courtès
2009-01-07 23:16 ` Neil Jerram
2009-01-08 21:43   ` Ludovic Courtès
2009-01-09 13:53     ` Neil Jerram
2009-01-12 17:08       ` Ludovic Courtès
2009-01-12 21:14         ` Neil Jerram
2009-01-12 22:12           ` Neil Jerram
2009-01-09 14:22 ` David Séverin
2009-01-12 11:10   ` 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=873adx1f9i.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@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).