Deleteing objects

BlitzMax Forums/BlitzMax Beginners Area/Deleteing objects

Scott Williams(Posted 2005) [#1]
How?

I am used to being able to delete or release objects with other languages.

I can't see in the docs how to get rid of a type after I have created one using NEW ?

If I unlink an object from a list will it still be floating around in memory.

I'm used to deleting and object and then removing its reference from a list.

Am I wrong?

Please help.

Cheers. Scott.


Booticus(Posted 2005) [#2]
Flushmem I think is what you're after. I think Blitz Max handles the garbage collection automatically. Just throw flushmem...um, I forgot, is it before the FLIP command or after? Anyone?


Neuro(Posted 2005) [#3]
I usually flush the memory immediately after I remove an object from the list.


Hotcakes(Posted 2005) [#4]
Removing links in a list (ie a lost type floating randomly around in memory) is the way to release it. If you have any integer variables pointing to something, simply set it to NULL. Or 0 might do.

Then, calling Flushmem (usually one call in your main game loop, doesn't matter where, your MAIN game loop though, not in any functions or whatever) is all you need. The garbage collector will decide when is the best time to unallocate your data.