Game Development Community

Explosion - memory leak?

by Radoslaw Marcin Kurczewski · in Torque Game Engine · 02/23/2003 (10:52 pm) · 7 replies

I need to create explosion effect in particular point, so I've wrote such a function:

function InitiateExplosion( %obj )
{
   %exp = new Explosion()
   {
      // in fact it's copy of rifle projectile explosion 
      // from FPS demo
      datablock = ExplosionData;
   }
   if( %exp )
   {
      %exp.setTransform( %obj.getTransform() );
      MissionCleanup.add( %exp );
   }
}

And... it works perfect till some moment... Game hangs up, while page file starts growing (exploding!) to few GB!
By default explosion has set lifetimeMS to 1000 - I left it untouched...

Does anyone idea, why such a situation occurs? How to solve it?

#1
02/23/2003 (10:57 pm)
MissionCleanup.add( %exp ) did't help :-(
#2
02/23/2003 (11:07 pm)
Have you tried running in debug mode? I've noticed when I get huge memory consumption that when I run in debug mode I nearly always get an error dialog to pop up.
#3
02/24/2003 (1:19 am)
Even better! I've run the game few times in debug mode and... nothing wrong happened - no problem, no hang up, no assertion at all!
It seems, release version differs a bit from debug one...

Brrr! Anyway I keep trying...
#4
02/24/2003 (2:17 pm)
We ran into the same problem--it was fixed by removing the soundProfiles in the explosion emitters. Seems like the sounds are stomping on something. This is a temporary fix cause the explosions are MUCH better with sounds :)
#5
02/24/2003 (7:23 pm)
If you own the SDK and do a search on the topic I believe it was discussed, actually I know it was discussed.

I submitted a temporary patch to Tim Gift about this a long time ago and I believe it is yet to be implemented.

I have yet to go back and actually fix it. The problem is the code works fine if the explosions are created by the projectile itself, but they will crash the engine if they are script-created.
#6
02/24/2003 (7:52 pm)
I've noted another fun sound bug...

Sounds may not get an audio handle, but they play anyway, so if the sound is a looping sound, it plays forever - until you exit out.

There was SUPPOSED to be a big audio engine update when marble blast that was supposed to address such issues, but I have yet to see anything :(

Or, maybe my team is lying to me about this, but at any rate, the bug is there and needs to be fixed :\
#7
02/24/2003 (9:21 pm)
Thanks a lot guys for your response!

Unfortunatelly I DID NOT use any sound profile for my explosion :-(
Anyway, I "solved" that problem by replacing "Explosion" with "ParticleEmitterNode"... For now it should be enough, but of course I would be very happy to find it fixed some day :-)

Again, thanks to all!