GC Hell

BlitzMax Forums/BlitzMax Programming/GC Hell

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Sounds like the OO design would need some rework if you have that many references to it that you can't say if all references are removed.

Normally, memory leaks are caused by cyclic structures (rings). for example:

a references b, b references c and c references a

such a ring will never be freed unless you manually break up at least 1 of those 3 references, because they all keep each other alive.
In such a case, you need a destroy method (which you most likely need anyway to remove its reference from the handling list / map) which just null-ifies all references stored on the current object. That way you normally do not have any problem. If you have a ring assigned to the object, just make sure that before you null the reference, that you call the destroy method on your "ring reference" as well.