Game Development Community

Memory leak onUpdateScene

by Lukas Macura · in Torque Game Builder · 06/15/2009 (1:54 pm) · 8 replies

we find that just this code on onUpdateScene create memory leaks (during few minutes many MB)

function LevelScenegraph::onUpdateScene( %this )
{
   if ($draggedStone != 0)  
   {
   } 
}

any ideas?

#1
06/25/2009 (6:58 am)
Any idea? It's really huge problem, because there is problem with scheduler on iphone and onUpdateScene cannot be used because memory leak.
#2
06/25/2009 (7:32 am)
I have no idea why a practically empty function should do that. It certainly hasn't been reported before.

Also, I take it from your post that this is an iTGB forum. You might want to post in there to see if someone has experienced this.

It there was a problem then it would be a fundamental problem that all TS owners would see. Very odd.
#3
06/25/2009 (8:31 am)
Same problem is in PC build of iTBG 1.2 too.
#4
06/25/2009 (11:47 am)
So you're saying that this happens on standard TGB v1.7.4? Do you have a project you could send to me? How do you see the "leaks" e.g. how are they reported or are you just seeing increased memory consumption?

melvm (at) garagegames (dot) com.

#5
06/25/2009 (1:03 pm)
Melv: check your email
#6
06/25/2009 (1:37 pm)
I haven't got anything yet. Make sure there was no executable in it.
#7
06/25/2009 (3:48 pm)
I have your email now.
#8
06/25/2009 (4:26 pm)
I have confirmed that there's a leak although I'm not actively developing on the iTGB codebase (it's not my project) but I will pass this on.

In TGB I always recommend that you don't call the scripts in "onUpdateScene()" as this is called each frame and I am not sure if you are aware or not but objects don't update each frame, they simply interpolate. Objects are updated each tick, during each frame they are interpolated between these tick updates which provides very smooth motion.

There is an almost identical callback but one that is only called during each tick which is technically a more appropriate scene-update. That is called "onUpdateSceneTick()".

"OnUpdateScene" should really be called "OnUpdateFrame()".

I don't get a leak with "onUpdateSceneTick()". Perhaps you can use this until this per-frame callback issue has been resolved.

I have logged this problem, ref: iTGB-18