Memory management with circular reference
Hi Guys
I got an unsolved problems with memory management and circular reference. Memory management means an object have to destroy itself when it's no longer used. Circular reference is the case when two object reference to each other either directly or indirectly.
The real case is I have a collection which hold a list of children. The children can be the object itself or the object's ancesstor. When a collection is deleted, it tries to delete all it's children and the children in turn try to delete the children of themselves. The probelm happens here because that cause an infinite recursive loop and object could be deleted more than one.
Anybody have an idea of how to solve it?
Thanks