Does Release release child types

BlitzMax Forums/BlitzMax Programming/Does Release release child types

Perturbatio(Posted 2004) [#1]
If I have a parent type and create child types as fields of that parent type, then release the parent type, will release clean up the child types as well?


Michael Reitzenstein(Posted 2004) [#2]
All release does is decrement the object's reference count in the garbage collector. If the integer handle was the sole reference to the object, it will be collected.

If the object that is destroyed has explicit references to other objects (eg Field Target:Enemy), and those references are the only reference to each of the child objects, they will be collected by the garbage collector. If they're stored in integer handles (eg Field RandomImage:Int), you'll have to add a destructor to the object to call release on the handles.


Perturbatio(Posted 2004) [#3]
ta :)


Dreamora(Posted 2004) [#4]
you could create a method

method delete()
' do the stuff you want
endmethod

to take care that it is really gone :)


Michael Reitzenstein(Posted 2004) [#5]
you'll have to add a destructor to the object to call release on the handles.