Hacker News new | ask | show | jobs
by whaleofatw2022 262 days ago
Dotnet does both mark and sweep as well as compaction, depends on what type of GC happens.
1 comments

In this case, we're discussing a case where mark-and-sweep is used to collect cyclic references, and it's implied that there are no generations. (Because otherwise, purely relying on reference counting means that cyclic references end up leaking unless things like weak references are used.)

IE, the critical difference is that reference counting frees memory immediately; albeit at a higher CPU cost and needing to still perform a mark-and-sweep to clear out cyclic references.