[Gc] Changing ‘GC_should_collect’ to account for malloc’d memory
ludo at gnu.org
Sun Feb 27 05:55:10 PST 2011
Bruce Hoult <bruce at hoult.org> writes:
> On Mon, Feb 28, 2011 at 1:29 AM, Ludovic Courtès <ludo at gnu.org> wrote:
>>> The person writing the application code could make a reasonable guess,
>>> or use dtrace or other tools to measure it once and then hard code it.
>>> Or proxy malloc() themselves.
>> So in the iconv example, you would give libgc an /estimate/ of amount of
>> heap associated with ‘iconv_t’, right?
>> The problem is that the estimate could vary greatly from system to
>> system. Wouldn’t it be risky to base GC decisions on such
> Maybe, but not worse than assuming it is zero :-)
It could be worse if it leads ‘GC_should_collect’ to return true more
often than necessary.
> Where I said "the person writing the application code" above, I meant
> whoever is writing the GC code. In the case of a language
> implementation such as Guile this would be the Guile implementors, not
> the end users writing scheme code.
Yes, of course.
> Do you have any objections to the idea to make this part of the
> finalization API?
Actually Guile has historically had such a function,
It doesn’t do anything in 2.0.0, but that could/should probably be
changed when libgc supports it.
More information about the Gc