BMAP* SuperMagma_tga = NULL;

action volcano()
{
if(!SuperMagma_tga) SuperMagma_tga = bmap_create("SuperMagma+32.tga");
...
}

Now you can either bmap_purge or ptr_remove that BMAP:

bmap_purge(SuperMagma_tga);
level_load(...);

Let's assume your BMAP is 8MB big. Then bmap_create with allocate 8MB first, then additional 8MB when the bmap is visible for the first time.
When you bmap_purge your bitmap the latter 8MB will be freed. In case it needs to be drawn again it will automatically be recreated (once until you purge it), based on the 8MB data which have been allocated firstly.



The alternative and probably the better solution would be to ptr_remove it:

ptr_remove(SuperMagma_tga);
SuperMagma_tga = NULL;
level_load(...);

Now all memory allocated for SuperMagma_tga has been freed, but you have to recreate the image yourself when it's needed.



I'm not sure if you could ptr_remove a globally pre-launch defined BMAP and get the memory back, maybe that would work as well. Do it the other way though!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends