Freeing a texture

Blitz3D Forums/Blitz3D Programming/Freeing a texture

Ross C(Posted 2003) [#1]
say if i load a sprite/texture. then i load the new texture/sprite using the same handle, will it free the old one from memory? ie.

Tex=LoadSprite("fire.bmp")

Tex=LoadSprite("spell.bmp")



Gabriel(Posted 2003) [#2]
I wouldn't have thought so. Not until you exit the program anyway, at which point Blitz apparently cleans everything away.

Question is: why would you want to use such bad programming practices? It's not hard to keep track of everything you create or load and free it again. It's a tad boring, I suppose, but it's not hard.


jfk EO-11110(Posted 2003) [#3]
tex is just a variable to store the mesh handle which is the return-value of the loadanything function. This way you would simply "forget" the handle.


Akat(Posted 2003) [#4]
i think not free it - just shift n replace it... it's like something to do with FIFO. it shift the first texture a bit to give a place to put in new texture.

btw - 'tex' only handle n nothing to do with bitmap size etc. so it still using 'memory' i think


_PJ_(Posted 2003) [#5]
To make sure, and to preserve memory add these lines of code:


Tex=LoadSprite("fire.bmp")

........

If Tex>0 Then FreeSprite Tex

Tex=LoadSprite("spell.bmp")




Ross C(Posted 2003) [#6]
Right cool, thanks. It was just i didn't wanna keep on freeing and copying textures all the time. But it should be cool, thanks all :D