How do I free a PixMap from memory?
BlitzMax Forums/BlitzMax Beginners Area/How do I free a PixMap from memory?
| ||
I want to load a PixMap, retrieve some colors and than delete it. It sounds so simple to do, but I have no clue. "Release"? (has something to do with an integer) "flushmem"? (Identifier flushmem not found) "AAARG" (help is apreciated) |
| ||
MyPixmap=null (=null is the general 'release' in BMax, also works on other stuff) |
| ||
Load another pixmap in it's place? Wait for the variable to go out of scope? Remove it from it's collection? |
| ||
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. 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?" |
| ||
Thank You CS_TBL! Thank You FlameDuck? [edit] Thank You tonyg! Yes, I knew about auto-garbageCollection, but I gues I didn't understand most of it. [edit again] Plus! Some explanations in Help are outdated or ? Because f.e. in some example by Mark himself (Keyword Release) he uses the function MemAlloced(), wich is not a BMax-function (anymore???). Stuff like that is rather confusing... |
| ||
yes yes, the manual.. pull a number and join the line please. :P |