How do I FreeImage()?

BlitzMax Forums/BlitzMax Beginners Area/How do I FreeImage()?

Wayward(Posted 2004) [#1]
BlitzMax doesn't have a FreeImage() function like the old Blitz, so what is the correct way to free images?


Michael Reitzenstein(Posted 2004) [#2]
If you're using integer handles eg:

RandomImage = LoadImage( <path> )


Then you need to use "Release RandomImage". If you're using explicit references, eg:

RandomImage:TImage = LoadImage( <path> )


When there are no more references to the loaded image, it will be freed automatically. Therefore,

RandomImage:TImage = LoadImage( <path> )
DrawImage RandomImage, 0, 0
RandomImage = Null


Will free the loaded image.


Wayward(Posted 2004) [#3]
Thanks, Michael, for the very clear answer.


Murilo(Posted 2004) [#4]
.