Game Development Community

Help: Managed datablocks still in memory?

by Sean Yeomans · in Technical Issues · 08/20/2008 (6:46 pm) · 5 replies

Hi guys,

I've reached the end of my level and upon reaching it, it loads up the next level.t2d fine. The problem is that my memory usage doesn't drop at all after going to the next level. All of my datablocks are in the managed folder.

- I've tried using some pieces of code to clear up the memory:

$thescenegraph.delete();
... this appears to make everything in the level go away, but it doesn't free up any memory.

$managedDatablockSet.clear();
... clearing the $managedDatablockSet SimSet doesn't clear anything up either.

Where are these datablocks being stored? Is there a way to access them and get rid of them for the next level?

Any information would help.
Thanks!

#1
08/20/2008 (7:27 pm)
There are threads around on this topic already, but the gist is, Torque uses a memory manager which holds onto freed memory and does not give it back to the OS, then Torque does not need to request more memory from the OS the next time someone new is allocated.
#2
08/21/2008 (5:37 am)
Thanks for the info, James.

Sorry but I can't seem to locate any of the threads concerning this... do you think you could point me in the right direction if possible?

Thanks again.
#3
08/21/2008 (9:28 am)
Just the couple results from the first page searching for "torque memory usage"
www.garagegames.com/blogs/4517/11311
tdn.garagegames.com/wiki/MemoryManager
#4
08/26/2008 (12:07 am)
Thanks again. I am currently working on a game with TGB. I am using the GUI interface to build my level and load my images using the create image map which creates managed data blocks. Upon completing each level in the game, I want to discard all the images which were created/loaded in the scene and in a sense start from scratch for the second level. My assumption is that I should be able to clear all the images I have used in the first level from memory(Torque Memory - Since its not returned to the OS) keeping my footprint and start from scratch again with no memory increase unless the current levels required memory exceeds the previous levels making a larger footprint. The problem with using the builder GUI is all the images from previous levels are accumulating in a column on the right within the program in turn increasing the memory footprint.
Any help would be appreciated.
#5
08/26/2008 (10:59 am)
You can look at the _initializeProject function in the root main.cs, and maybe in properties.cs, somewhere around there is where managed/datablocks.cs is loaded. That might give you an idea how you could break it up, per level.

The simplest thing might be to have several simset or simgroups of imagemapdatablocks, one for each level, then you can loop through/delete them whever you like.