Deleting types

Blitz3D Forums/Blitz3D Programming/Deleting types

Shifty Geezer(Posted 2005) [#1]
Can someone please confirm that when I delete a custom object, it deletes any sub-objects? eg. given...

Type vec
field x#
field y#
field z#
End Type

Type player
field speed%
field siz.vec
field position.vec
End Type

player1.player = New player
player1\speed=10
player1\size=New vec
player1\size\x=24.0
player1\size\y=4.0
player1\size\z=10.0
player1\position=New vec
player1\position\x=48.3
player1\position\y=15.2
player1\position\z=74.6

...then I can do...

Delete(player1)

...and not have to worry about...

Delete(player1\size)
Delete(player1\position)
Delete(player1)

Right?


Warren(Posted 2005) [#2]
I don't believe so. There is no garbage collector in Blitz3D, so what you allocate - you must delete.


Beaker(Posted 2005) [#3]
You must delete sub-types as well.


big10p(Posted 2005) [#4]
Yep, you have to explicitly delete all type instances - unless you use the 'Delete Each myType' maxim.


Shifty Geezer(Posted 2005) [#5]
Okay. Thanks.