Torque X huge memory leak - Fixed
by Giuseppe De Francesco · in Torque X 2D · 03/18/2010 (11:54 am) · 298 replies
Well,
I'm not sure this is the right place to post this, maybe the blog? At any rate I'm posting here now.
Torque X has a huge memory leak, but seriously! I was working to a RPG game for a start so I didn't really notice, but 2 weeks ago I started YASS, a multiplayer side scrolling space shooter: a lot of particles, really a lot, and a lot of projectiles as well.
To let you understand here follows a short video of the game:
This is the memory situation after 3 minutes of gameplay (single player!!!) the game slowed down a lot:

So, I searched the forum and I realized that this issue is an old one and GG never got a grip on it (go figure why...) so I decided to fix the problems myself because I really need to publish YASS ;)
Long story short: I revised the whole engine and made a lot of fixes, some of them really of great importance, so here it is the situation playing my game (as you can see after 9 minutes the game still is 20% less than the original 3 minutes!):

There are still many stuff to fix, but at any rate in the current state I'm able to publish the game ;) I will make the SVN diff files available upon request (free of charge: pino AT dftgames DOT com).
Cheers,
Pino
I'm not sure this is the right place to post this, maybe the blog? At any rate I'm posting here now.
Torque X has a huge memory leak, but seriously! I was working to a RPG game for a start so I didn't really notice, but 2 weeks ago I started YASS, a multiplayer side scrolling space shooter: a lot of particles, really a lot, and a lot of projectiles as well.
To let you understand here follows a short video of the game:
This is the memory situation after 3 minutes of gameplay (single player!!!) the game slowed down a lot:

So, I searched the forum and I realized that this issue is an old one and GG never got a grip on it (go figure why...) so I decided to fix the problems myself because I really need to publish YASS ;)
Long story short: I revised the whole engine and made a lot of fixes, some of them really of great importance, so here it is the situation playing my game (as you can see after 9 minutes the game still is 20% less than the original 3 minutes!):

There are still many stuff to fix, but at any rate in the current state I'm able to publish the game ;) I will make the SVN diff files available upon request (free of charge: pino AT dftgames DOT com).
Cheers,
Pino
About the author
In the software eng. field since 1981, in charge of R&D during last 10 years. IEEE Senior Member (and volunteer).
#202
04/22/2010 (6:22 am)
@Tony: on a Virtual Machine the 3D graphics is non existent as the graphic card is a S3, really no use :(
#203
I was working with John K. a little while back to help figure out why the editor was crashing. I have a Dell XPS M1730 with dual NVidia 8700 cards in it. I am also running Windows 7 and at the time was running Windows Vista.
The one thing I found about the editor was that it would crash a lot when I had SLI turned on. If you are using NVidia SLI, try turning it off and see if that helps.
We all know you are busy and thank you for all the work!
04/22/2010 (6:59 am)
@Pino: I think you meant at Duncan, but we all know what you mean :-). Also, I remember you emailing me that you were able to reproduce the issue in the FPS demo when you picked the Physics menu option. Did that change? I can work on making a sample that will cause the problem if you like.I was working with John K. a little while back to help figure out why the editor was crashing. I have a Dell XPS M1730 with dual NVidia 8700 cards in it. I am also running Windows 7 and at the time was running Windows Vista.
The one thing I found about the editor was that it would crash a lot when I had SLI turned on. If you are using NVidia SLI, try turning it off and see if that helps.
We all know you are busy and thank you for all the work!
#204
04/22/2010 (7:29 am)
@Duncan: Please do send the differences. I would love to have async loading.
#205
04/22/2010 (8:20 am)
@Tony: I need your email address to send you stuff :) you can find mine in this thread if you like.
#206
Another intersting thing is it will not even run on the xbox for me. I get an error Line235 TorqueEngineComponent.

04/22/2010 (12:10 pm)
For the 3D issue this is literally all I did, create new project, TorqueX Simple 3D pro. Link it to the new core and new TX3D. when you view it what happens is the terrain outside the main terrain block, like the replicated terrain is blue, as you move closer it changes to green then red. Interesting pattern no? Another intersting thing is it will not even run on the xbox for me. I get an error Line235 TorqueEngineComponent.
234: #if XBOX 235: return Game.IsActive && !Guide.IsVisible && !_exiting; 236: #else

#207
04/22/2010 (2:14 pm)
I really don't think that line(235) should be there anyway. It would stop multiplayer LIVE games from continuing to run when the guide is showing - which would fail the game in peer review.
#208
I wrapped up that line to deal with the absence of the LIVE component so you just need to get the last version from the SVN repo ;)
The colours are a problem tied to the camera's far point computing. I think that the code used some of the disposesed objects relying on a bug as it was a feature :) I'm looking into that right now.
04/23/2010 (10:12 am)
Hey guys,I wrapped up that line to deal with the absence of the LIVE component so you just need to get the last version from the SVN repo ;)
The colours are a problem tied to the camera's far point computing. I think that the code used some of the disposesed objects relying on a bug as it was a feature :) I'm looking into that right now.
#209
Let's dig into this a little more.
04/23/2010 (10:18 am)
@Duncan: I think you're right about the peer review issue for networked games, I didn't think about that. This opens a problem about the other peer review fail: opening the Guide while the game is starting (when you have the XNA logo on the screen). Removing that Guide test the game often crashes if the Guide is visible during the start-up. Let's dig into this a little more.
#210
04/23/2010 (11:05 am)
I haven't managed to crash any of my games by doing the 'guide at startup' thing. Do you have a repro project for that?
#211
I think Pino fixed that one, I have neve had it happen but he said his daughter was able to crash it every time, I guess my reaction times are not what they used to be ;)
04/23/2010 (11:25 am)
@DuncanI think Pino fixed that one, I have neve had it happen but he said his daughter was able to crash it every time, I guess my reaction times are not what they used to be ;)
#212
This is not the final fix because the problem is elsewhere, but at least we don't have those colours :)
04/23/2010 (11:36 am)
Guys, as soon the SVN repository is back online (down for maintenance now) I'll commit a quick fix for the 3D colours.This is not the final fix because the problem is elsewhere, but at least we don't have those colours :)
#213
04/23/2010 (12:14 pm)
@Duncan: the only reference to your email I found was duncan at flooge plus com. I tried to send an email to the address I figured that you meant and it bounced.
#214
By the way there are three parts to my email address after the @, if that helps you decipher it at all :)
04/23/2010 (12:34 pm)
@Tony: what's you're email?By the way there are three parts to my email address after the @, if that helps you decipher it at all :)
#215
Also I was going to upload a dye material that can be used to swap color channels on a animated sprite to the community project.
I'm getting this error in SVN when trying to commit though :(
Command: Commit
Error: Commit failed (details follow):
Error: Server sent unexpected return value (403 Forbidden) in response to MKACTIVITY
Error: request for '/svn/TX2DCommunityProject/!svn/act/af2f956d-d9c4-3c49-9be9-e2a163c90553'
Finished!:
You guys happen to know what would cause this?
04/23/2010 (11:16 pm)
I've been busy the last few weeks but am really looking forward to implementing all the changes that have happened.Also I was going to upload a dye material that can be used to swap color channels on a animated sprite to the community project.
I'm getting this error in SVN when trying to commit though :(
Command: Commit
Error: Commit failed (details follow):
Error: Server sent unexpected return value (403 Forbidden) in response to MKACTIVITY
Error: request for '/svn/TX2DCommunityProject/!svn/act/af2f956d-d9c4-3c49-9be9-e2a163c90553'
Finished!:
You guys happen to know what would cause this?
#216
04/24/2010 (2:56 am)
@Matthew: that's odd, you do have write permission on the community project. Please try again and if you still have issues send me an emai with the full detail so I can call xp. They moved their servers yesterday so maybe something backfired.
#217
We got a major issue here. I’ve just restored the original TX3D engine on my computer and I have deployed the FPS Demo to the Xbox (original Core and original TX3D). The result is worse than what I got using the fixed Core and TX3D. There are many different problems and the frame rate in the physics demo is very low, slowing down progressively.
Taking this from the beginning I changed the original Core with the fixed one and nothing changes about the performance in the Physics demo. I see some general improvements and the only issue is about the coloured chunks of the terrain, so this will be my next thing to fix. Further investigations are needed on the Physics part of the demo, but without a unit test this will be hard.
I’m sorry not having tested the original FPS environment before but, as I said, I’m not able to use the editor on any of my machines so I couldn’t really use the 3D engine. I need to get some small unit test project somehow (I’m not really keen to write the XML level by hand because I might forget some piece thus being driven on a wild goose chase).
Any volunteer for that unit test?
04/25/2010 (3:18 am)
Hi,We got a major issue here. I’ve just restored the original TX3D engine on my computer and I have deployed the FPS Demo to the Xbox (original Core and original TX3D). The result is worse than what I got using the fixed Core and TX3D. There are many different problems and the frame rate in the physics demo is very low, slowing down progressively.
Taking this from the beginning I changed the original Core with the fixed one and nothing changes about the performance in the Physics demo. I see some general improvements and the only issue is about the coloured chunks of the terrain, so this will be my next thing to fix. Further investigations are needed on the Physics part of the demo, but without a unit test this will be hard.
I’m sorry not having tested the original FPS environment before but, as I said, I’m not able to use the editor on any of my machines so I couldn’t really use the 3D engine. I need to get some small unit test project somehow (I’m not really keen to write the XML level by hand because I might forget some piece thus being driven on a wild goose chase).
Any volunteer for that unit test?
#219
thanks a lot! Also a reduction of the FPS demo Physics level will do, maybe even simpler. A simple level allowing to push around or shoot objects on the scene all having physics behaviours which looks to be the issue or is what makes the problem visible.
04/25/2010 (9:05 am)
Hey Henry,thanks a lot! Also a reduction of the FPS demo Physics level will do, maybe even simpler. A simple level allowing to push around or shoot objects on the scene all having physics behaviours which looks to be the issue or is what makes the problem visible.
#220
If you give me a place in the SVN repo I can upload the source. I have also zipped the whole thing up. It is about 3.5 MB.
This demo is a simple beginning project. I then added my zombie to the xml file. I also removed the terrain because it adds about 20 seconds to the load time while not affecting the slow down at all.
It would be better if I could submit the SVN because I too snap shots just after finishing it, then after applying your core patches and then after applying your 3D patches.
04/25/2010 (9:28 am)
@Pino: I sent you an email yesterday. I have already created a small test project with 10 of my Zombie models in it. I am surprised you didn't get the email.If you give me a place in the SVN repo I can upload the source. I have also zipped the whole thing up. It is about 3.5 MB.
This demo is a simple beginning project. I then added my zombie to the xml file. I also removed the terrain because it adds about 20 seconds to the load time while not affecting the slow down at all.
It would be better if I could submit the SVN because I too snap shots just after finishing it, then after applying your core patches and then after applying your 3D patches.
Torque Owner Duncan Colvin
@Eric: that's great news to hear - especially with XNA 4.0 on the way as well :-)