does GuiBitmapCtrl free the texture memory when deleted?
by Eyal Erez · in Torque Game Builder · 08/04/2010 (9:45 pm) · 7 replies
I'm trying to figure out how come when I load a gui with a guiBitmapCtrl and later on delete the gui, the memory that the program is consuming is not going done.
if I do it repeatedly.....
exec("game/gui/testGui.gui")
testGui.delete()
exec("game/gui/testGui.gui")
testGui.delete()
etc....
it will just keep going up.
Is there any solution to this issue?
if I do it repeatedly.....
exec("game/gui/testGui.gui")
testGui.delete()
exec("game/gui/testGui.gui")
testGui.delete()
etc....
it will just keep going up.
Is there any solution to this issue?
About the author
#2
Basically , I'm trying to understand why my game keeps running out of memory.
I think I'm doing a pretty good job cleaning up each level by using %scenegraph.endlevel() and %scenegraph.delete(), I'm also deleting every gui when I'm done with it to release memory.
I have in my game a restart level button which pretty much endlelvel()
and delete() the scenegraph as well as cancels any schedules then
reloads the level again. if I restart the level many times (over
40-50) I run out of memory and the game crash.
Is there anything else I need to free or delete?
08/04/2010 (10:25 pm)
ok, I see your point.Basically , I'm trying to understand why my game keeps running out of memory.
I think I'm doing a pretty good job cleaning up each level by using %scenegraph.endlevel() and %scenegraph.delete(), I'm also deleting every gui when I'm done with it to release memory.
I have in my game a restart level button which pretty much endlelvel()
and delete() the scenegraph as well as cancels any schedules then
reloads the level again. if I restart the level many times (over
40-50) I run out of memory and the game crash.
Is there anything else I need to free or delete?
#3
08/05/2010 (12:40 am)
Do you new up anything like ScriptObjects, SimSets, or the like?
#4
Based on your experience are most memory leaks have been fixed? I'm still using some version of 1.7.4
08/05/2010 (2:20 am)
no, simSets I just clear(). and I can't think of anything else.Based on your experience are most memory leaks have been fixed? I'm still using some version of 1.7.4
#5
08/05/2010 (2:35 am)
There are memory leaks in the 1.7.4 audio that are fairly significant, especially if you use streaming audio. If you haven't made source code changes, I'd migrate over to 1.7.5 and see if you still have the same problem. (Even if you made source code changes, I'd still recommend it.)
#6
Did you get the answer for your question? I'm also searching for it.
08/05/2010 (4:47 am)
@Eyal...Did you get the answer for your question? I'm also searching for it.
#7
So I'm going over the forum and implementing the fixes myself. This community is so awesome for working together and posting out code.
Maybe I should run a huge diff between the wii version and 1.7.5 and find out the hard way what's different.
Thanks for your help, I'll take your advice on the 1.7.5 ;)
08/05/2010 (2:41 pm)
For the PC I will definitely. The problem is that I'm using tgb4wii which is build on top of 1.7.4, before all the memory leak fixes on 1.7.5 :)So I'm going over the forum and implementing the fixes myself. This community is so awesome for working together and posting out code.
Maybe I should run a huge diff between the wii version and 1.7.5 and find out the hard way what's different.
Thanks for your help, I'll take your advice on the 1.7.5 ;)
Associate William Lee Sims
Machine Code Games
When the GUI is removed, it should be calling sleep on it (which you can test by putting an echo statement in an onSleep callback). The sleep sets the TextureHandle to null. If the texture isn't being used anywhere else, then the texture is freed. Then, since the new texture is null, nothing else happens.
Torque manages its own memory, so you rarely see it go down. But what you are doing shouldn't cause it to go up forever.
One other thing that *MIGHT* be happening is that your GUI is newing up memory and not releasing it when you delete it. Do you do anything when the gui wakes up? (Say, in an onWake callback?)