GNU bug report logs - #20907
[PATCH] Manual bug for scm_gc_protect_object

Previous Next

Package: guile;

Reported by: Mike Gran <spk121 <at> yahoo.com>

Date: Fri, 26 Jun 2015 23:05:02 UTC

Severity: normal

Tags: patch

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 20907 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Mike Gran <spk121 <at> yahoo.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 20907 <at> debbugs.gnu.org
Subject: Re: bug#20907: [PATCH] Manual bug for scm_gc_protect_object
Date: Wed, 02 Sep 2015 12:52:54 -0400
Mark H Weaver <mhw <at> netris.org> writes:

> Mike Gran <spk121 <at> yahoo.com> writes:
>
>>> On Wednesday, September 2, 2015 5:09 AM, Ludovic Courtès <ludo <at> gnu.org> wrote:
>>
>>> I think the manual is correct: global C variables were *not* scanned by
>>> the GC.
>
>> For what it is worth, the effect that I was seeing that made me
>> question the documentation can be demonstrated by the attached program,
>> where two 100MB Guile strings are stored in a C globals: one protected
>> and one not. 
>>
>>
>> In 1.8, a GC operation reduces memory from 200MB to 100MB, which I
>> assume is freeing the memory from the unprotected string.
>
> I'm not sure why this result would make you question the current
> documentation.  To my mind, it clearly confirms what Ludovic wrote.
>
> If global C variables were scanned by default in 1.8, as you asserted,
> then why would the unprotected string have been freed?

It occurs to me that this confusion might have arisen from a lack of
knowledge about garbage collection and what it means to "scan"
something.  "Scanning" is more or less a synonym for "marking", where
the reachable objects are first marked starting from the roots, and
after that's done, anything that is not marked will be freed in the
sweep phase.

I wonder if Mike might have been thinking that something cannot be freed
unless it is scanned, so if it is freed that is evidence that it was
scanned.  In fact, scanning (marking) is necessary to *prevent* freeing,
not to enable it.

      Mark




This bug report was last modified 9 years and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.