Unloading an imageMap?
by Vern Jensen · in Torque Game Builder · 08/27/2009 (1:46 am) · 5 replies
To allow my game to have a splash screen *while* loading graphics, I have moved most of the datablocks out of
/managed/datablocks.cs
into a different file, leaving in datablocks.cs *only* the files used for my game's logo and splash screens. Once the logo screen is done (it is an animation that uses about 5 sprites), I want to "free" these images (dispose, delete, whatever you want to call it) before manually loading datablocks.cs. Is there a call to do this? A call that tells the engine "I'm *never* going to use these images again, for the rest of the game. Get rid of them. Pretend I never loaded them. Free up their memory and VRAM usage entirely." ?
Obviously I could use .delete, but that only deletes the current reference. I want to free it up as if I never loaded it in the first place. Gone permanently.
/managed/datablocks.cs
into a different file, leaving in datablocks.cs *only* the files used for my game's logo and splash screens. Once the logo screen is done (it is an animation that uses about 5 sprites), I want to "free" these images (dispose, delete, whatever you want to call it) before manually loading datablocks.cs. Is there a call to do this? A call that tells the engine "I'm *never* going to use these images again, for the rest of the game. Get rid of them. Pretend I never loaded them. Free up their memory and VRAM usage entirely." ?
Obviously I could use .delete, but that only deletes the current reference. I want to free it up as if I never loaded it in the first place. Gone permanently.
#3
No need for that in this case though.
08/27/2009 (2:29 pm)
safeDelete() simply helps you avoid crashes. For instance, if you want to delete an object from within its own callback function, that can sometimes cause a crash, so you use safeDelete() instead.No need for that in this case though.
#4
In this thread Stephen says that "If you are assuming that Torque will release memory back to the operating system, that does not happen."
Unfortunate.
08/27/2009 (5:09 pm)
It doesn't seem that there is a way. In this thread Stephen says that "If you are assuming that Torque will release memory back to the operating system, that does not happen."
Unfortunate.
#5
08/27/2009 (5:30 pm)
Bummer. What about from C++ then? Any way to free up system memory (unload a datablock) from C++? I've got the source and could export a method to script if the method is already there in the source.
Torque Owner Vern Jensen
deleteAllObjectsInSimSet( $managedDatablockSet ); function deleteAllObjectsInSimSet( %theSimSet ) { while (%theSimSet.getCount() > 0) { %object = %theSimSet.getObject(0); %theSimSet.remove(%object); // Apparently this is unnecessary, but we do it anyway %object.delete(); } }