I am currently implementing a garbage collector (in C ++) using the reference counting method. However, the big problem is that if the data is cyclically referenced, it is never collected, since their reference counts are always non-zero.
I tried searching and found these things called trash garbage collector, marking and sweep algorithm, etc. Is it possible to implement it? And how exactly do they work?
source share