Better memory management. Why doesn't Torque let go?
by Jonathan R Hopkins · in Technical Issues · 01/04/2010 (3:49 am) · 3 replies
Any time I create a new sound object or image within Torque, Torque never lets go of the memory allocated for it. With respect to images, even if I have "allowUnload" set to true, and after I've deleted every object that actually utilized the t2dImageMapDatablock, the memory set aside for that t2dImageMapDatablock never gets relinquished.
Similarly, any time Torque plays a sound file it gets as much memory as it needs, but it never lets go. I found a bit of a solution in this thread: www.torquepowered.com/community/forums/viewthread/107965 but this does not actually solve the problem of Torque not letting go, it simply reduces the seriousness.
So here's my question. How do you force it to let go? Is there any possible way? I have a hard time believing that Torque really has no method for this built in, and furthermore, that it could possibly be considered okay that it does this if there is no method, because that would essentially limit the number of unique images and sounds you could use even if you only use a small amount at a time, as long as load in new stuff, the memory keeps going up and doesn't go back down.
Thanks for any thoughts or guidance on this.
Similarly, any time Torque plays a sound file it gets as much memory as it needs, but it never lets go. I found a bit of a solution in this thread: www.torquepowered.com/community/forums/viewthread/107965 but this does not actually solve the problem of Torque not letting go, it simply reduces the seriousness.
So here's my question. How do you force it to let go? Is there any possible way? I have a hard time believing that Torque really has no method for this built in, and furthermore, that it could possibly be considered okay that it does this if there is no method, because that would essentially limit the number of unique images and sounds you could use even if you only use a small amount at a time, as long as load in new stuff, the memory keeps going up and doesn't go back down.
Thanks for any thoughts or guidance on this.
#2
03/11/2010 (10:57 am)
I've decided to bump to this since I'm still having the issue. And its just getting worse. Any thoughts from anyone?
#3
Basically:
Probably a better way to fix this, but this seems to work for now.
12/26/2011 (12:00 pm)
Bumping an old thread, but I've been trying to research this as I've been having the same basic issue. All my music is set to not pre-load, but I noticed that it would stay in memory forever after playing once when the game was running. I saw that someone in another thread about this mentioned that reloading openGL sound seemed to fix this, which is true. I added a call to stop and restart the audio, which seems to actually clear out the memory, at a couple key points where my game would be switching audio anyhow.Basically:
alxStop($musicHandle); shutdownOpenAL(); initializeOpenAL(); $musicHandle = alxPlay(townMusic); ...
Probably a better way to fix this, but this seems to work for now.
Associate Rene Damm
As for audio memory not being released, you may be fighting with the issue addressed here and summed up here.