4 ms·
If you define garbage in the conventional way — “objects that can never be reached from any GC roots” — determining what objects are garbage only takes linear t
by tylerhou 3y ago
If you define garbage in the conventional way — “objects that can never be reached from any GC roots” — determining what objects are garbage only takes linear time (tracing)…
Reference counting helps the tracing phase out by pruning objects that are clearly garbage early — if a refcount hits zero, that object can clearly be deallocated safely. The converse is not true, which is why we need tracing.