How do I FreeImage()?

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

BlitzMax doesn't have a FreeImage() function like the old Blitz, so what is the correct way to free images?

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.

Thanks, Michael, for the very clear answer.

.