Game Development Community

Clearing memory from resource

by Vyacheslav Maltsev · in Torque Game Engine · 02/11/2008 (12:28 am) · 1 replies

Greetings everyone!

I have a little question. It seems very simple but I don't know answer. So, I'm loading the texture (creating datablock) at start of game level. Level is over and I have to replace the texture. How should I do it, considering the fact that datablocks are made once in the beginning of the game?
One more: Than I'm destroing object it seems picture still stays in memory. How can I free it?

Thank you!

p.s. It's all on TGE 1.5.2

#1
02/23/2008 (10:16 pm)
I'm not sure I understand the question, and it would seem no one else did either since you haven't gotten a response.

If the level has actually ended and a new level has been loaded, the datablock should no longer be in memory. As I understand it, the level load process re-sends all the datablocks each time, regardless of whether they've already been loaded once (because, for example, a specific level may trigger script events which define new datablocks).

It should be safe to alter your datablocks between levels without worrying about wasting memory, but I can't speak for how TGE manages memory in these cases.

It's worth mentioning that the Windows Task Manager memory usage report doesn't actually return a totally accurate picture of memory use.. as it was explained to me, Windows tends to hold memory for a program for some time even though the program may no longer be using it. Someone more technical in this area could probably explain that bit better.

If you could elaborate a bit on what you're trying to do you'd likely get some better answers.