How do I free a PixMap from memory?

BlitzMax Forums/BlitzMax Beginners Area/How do I free a PixMap from memory?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you create in in it's own function you can use local mypixmap:TPixmap=loadpixmap("blah.png"), extract your colours and when you exit the function the pixmap will be gone. e.g. Going out of scope.
Graphics 640 , 480
GCSetMode 2 ' Turn off auto-GC and do it manually
GCCollect()
Print "Before we start " + GCMemAlloced()
extract_colours("max.png")
GCCollect()
Print "Pixmap gone " + GCMemAlloced()
Function extract_colours(filename:String)
	GCCollect()
	Print "Pre-pixmap " + GCMemAlloced()
	Local mypixmap:TPixmap = LoadPixmap(filename)
	GCCollect()
	Print "Post pixmap " + GCMemAlloced()
End Function

and pixmap=null
Graphics 640 , 480
GCSetMode 2
GCCollect()
Print "Before we start " + GCMemAlloced()
'extract_colours("max.png")
Local mypixmap:TPixmap=LoadPixmap("max.png")
GCCollect()
Print "Pixmap alloc " + GCMemAlloced()
mypixmap = Null
GCCollect()
Print "Pixmap nulled " + GCMemAlloced()

<Edit> You do know that Bmax has auto-garbage collection... don't you?"