freeing

BlitzMax Forums/BlitzMax Beginners Area/freeing

D4NM4N(Posted 2006) [#1]
how do i free an image and a pixmap?!?


tonyg(Posted 2006) [#2]
Remove them from any list then either let them drop out of scope or null/reuse the variable.


Dreamora(Posted 2006) [#3]
To clear that up: you don't do it manually. It is freed, when it isn't reference anymore (when using :TImage and :TPixmap etc which you should. Doing it the old blitz way with int handles is several times slower because it has no optimized memory handling as typed with its garbage collector)


D4NM4N(Posted 2006) [#4]
Wow, i like that :)


Grey Alien(Posted 2006) [#5]
One thing to bear in mind. Say for whatever reason you alias an object i.e. you make a variable that points at it. If you null that variable, the object still exists until you null the original variable e.g.

MyObject = TImage
a:TImage = MyObject 'alias
a = null 'it's not freed yet
MyObject = null 'it is freed now



Reaper(Posted 2006) [#6]
Mark explains this all quite clearly here in the Wiki - http://www.blitzwiki.org/index.php/Memory_management :)