Idea #1 on integrating RC with GC
Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Wed Feb 5 05:40:19 PST 2014
On Wednesday, 5 February 2014 at 12:12:01 UTC, Paulo Pinto wrote:
> Yes, the GC just needs to check roots for already released
> blocks, if I am not mistaken.
Yes, when they go to non-zero. This is the scheme used in PHPs
ARC/GC solution, published in this paper:
http://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon01Concurrent.pdf
You push roots that are candidates onto a queue when the counter
is decreased to nonzero, then you do a concurrent scan when you
have a set of roots to scan for cycles. So you probably need a
clever ARC to reduce the scanning.
I think however, that for most programs that use ARC you don't do
the GC at all. For long lived processes such as servers you might
run it using heuristics (based on memory headroom or during the
night). According to the paper above the amount of cyclic garbage
tends to be low, but varies a great deal. They site another paper
relating to Inferno that supposedly claims that RC caught 98% of
the garbage. So the need for cycle collection is rather
application specific.
Perl has traditionally not caught cycles at all, but then again
perl programs tends to be short lived.
----
There are also some papers on near real time GC, such as Staccato
and Metronome, on David F. Bacons list:
http://researcher.watson.ibm.com/researcher/view_pubs.php?person=us-bacon&t=1
More information about the Digitalmars-d
mailing list