I do not think this has anything to do with a particular algorithm.
When the GC calculates a graph of object relationships, the information that the Collection object is solely responsible for these list items is implicitly present in the graph if the compiler was good enough to retrieve it.
Regardless of the GC algorithm chosen: the information is more dependent on how the compiler / runtime will extract this information.
Also, I would avoid C and C ++ with GC. Because of the arithmetic of pointers, aliases, and the ability to point inside an object (a reference to a data element or in an array), it is incredibly difficult to perform accurate garbage collection in these languages. They were not created for this.
source share