Re: Promptness of collection

"Jon Harrop" <[email protected]> Wed, 13 Mar 2013 12:20:25 -0000
Newsgroups gmane.comp.programming.garbage-collection.general
Organization Flying Frog Consultancy Ltd.
Message-ID <[email protected]>
Eliot Moss:
> The C++ compilers probably aren't as "smart" about noting when a variable
> becomes dead, and end up deferring the reference count work to the end
> of the call. This may also be effectively required by C/C++ semantics, in
> which case I blame it on the language, and again not on the GC algorithm
> per se.

The language semantics require it in that case. However, in the general case
a language designer could choose between register-level reference counting,
scope based and/or deferred and so on. Those present trade-offs between
performance and promptness. We have quantitative measurements about
performance but I haven't seen any about promptness.

In particular, that paper describes "intercepting every pointer mutation,
including those to registers and stacks" as "extremely costly" so I assume
they are doing scope-based reference counting instead, in which case they
could be generating a lot of floating garbage. For example, the F# function
I gave earlier would leak under that model.

Cheers,
Jon.

-----Original Message-----
From: Eliot Moss [mailto:[email protected]] 
Sent: 12 March 2013 22:13
To: [email protected]
Cc: [email protected]
Subject: Re: [gclist] Promptness of collection

Dear Jon -- I think the difference you're mentioning has more to do with
differences in the smartness of analysis in different compilers than
something fundamental about different GC algorithms.  The C++ compilers
probably aren't as "smart" about noting when a variable becomes dead, and
end up deferring the reference count work to the end of the call.
This may also be effectively required by C/C++ semantics, in which case I
blame it on the language, and again not on the GC algorithm per se.

Compilers for functional languages tend to emphasize these kinds of analyses
since they allocate so many objects implicitly, which makes the
optimizations more important to obtaining good performance at all.

In sum, I think it's compiler and language differences, not the different GC
algorithms.

Regards -- Eliot