Skip to content

Comment on Baby’s First Garbage Collector (2013)parent

Comments

When an object O is deleted, it needs to be removed from the linked list by patching the pointer that led to O to lead to O->next instead. There are two cases: for the first object in the list, you need to patch vm->firstObject; for the rest, you need to patch prevObject->next. You can unify these cases by storing a pointer to the pointer you need to patch, ie. a pointer to the pointer that led to O.

See also https://stackoverflow.com/questions/12914917/using-pointers-....

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.