Data-Flow (Escape) Analysis to Aid in Avoiding GC
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 13 05:07:03 PST 2015
Per Nordlöw:
> Then how does the GC know when to release when there are
> multiple references?
The mark phase counts what's reachable and what can't be reached.
If an object has one pointer to it, or one hundred pointers, it
is not removed. If nothing points to it, it is removed.
I suggest you to read how a mark&sweep GC works, or better to
implement a bare-bones mark&sweep GC in C language yourself for
Lisp-like cons cells, you only need 100 lines of code or so to do
it.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list