Suppose I have a two-way linked list. I want to remove a sequence from it like this:
begin - element - element x element - element - element x element - end
\_________________________________/
-: reference
x: removed reference
I would like to know if I also should remove the references between the elements that are to be removed, or if the garbage collector handles it in a better way.
the standard garbage collector uses a mark and sweep algorithm which can handle circular references so there is no need to null those (only the references from reachable memory to unreachable should be nulled)