Game Development Community

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:

forum.xnaitalia.com/download/leak1.png

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!):

forum.xnaitalia.com/download/leak2.png

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).

Page«First 9 10 11 12 13 14 15 Next»
#281
06/06/2010 (1:45 am)
Pino, I got TX trough a normal SVN-checkout. However, I have created a new project as you described. Deleted the copied engine projects and changed the references to the TX-install, where I have the version from the svn. Then compiled and tried again and everything works now as it should ;-)! Don't know what happened in the first tries, but now it works. Thanks all for the help, much appreciated.
#282
06/06/2010 (9:01 am)
@Andy: you're welcome ;)
#283
06/06/2010 (9:10 am)
@Henry: actually that Effect copy in the CopyTo wasn't there since the beginning but all works as it's supposed to... have to have a look at this thing, it's kinda strange. Problem with the TX3D is that I can't use the editor 'cos it crashes all the time :S
#284
06/06/2010 (10:36 am)
Oh I am certain it wasn't there. However when I tried to clone an effect it gave me an assert.

I am not even using the 3D editor, all my 3D stuff is in code.
#285
06/06/2010 (10:44 pm)
Found something weird happening, I would bet it's in the core because it happens on both 2D and 3D. This only happens on the xbox. Here is a log of the console output. I put the line frame in there to print once a frame.

'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'GAME:runtimev3.1mscorlib.dll'
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'T:584E07D1StarterGame3D.exe', Symbols loaded.
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'T:584E07D1GarageGames.TorqueX.Framework.dll', Symbols loaded.
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'GAME:runtimev3.1Microsoft.Xna.Framework.Game.dll'
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'GAME:runtimev3.1Microsoft.Xna.Framework.dll'
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'GAME:runtimev3.1System.dll'
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'GAME:runtimev3.1System.Xml.dll'
'a254ee13fe224e91b82f2b96b7ccabdc' (Managed): Loaded 'T:584E07D1GarageGames.TorqueX.Framework3D.dll', Symbols loaded.
The thread 0xf900001c has exited with code 0 (0x0).
The thread 0xf900001c has exited with code 0 (0x0).
The thread 0xf9000040 has exited with code 0 (0x0).
The thread 0xf900001c has exited with code 0 (0x0).
The thread 0xf9000040 has exited with code 0 (0x0).
The thread 0xf900001c has exited with code 0 (0x0).
The thread 0xf9000040 has exited with code 0 (0x0).
The thread 0xf900001c has exited with code 0 (0x0).
The thread 0xf9000040 has exited with code 0 (0x0).
The thread 0xf900001c has exited with code 0 (0x0).
The thread 0xf9000040 has exited with code 0 (0x0).
The thread 0xf900001c has exited with code 0 (0x0).
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
frame
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
frame
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
frame
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
frame
 (more of the same)
The program '[5699] Managed' has exited with code 0 (0x0).

So you see it happens about 3 times per frame, from what I understand from the XNA forums this is something that could manifest in an exception.

It also seems to take even longer to load in TX3D than it used to. Could be my perception though.

#286
06/07/2010 (1:30 am)
Hey Henry,

a 3 times per frame thing can be anywhere in between the events pumping and their execution and in any ticked object.

It's very interesting that this is just happening on the Xbox. The "First chance exception" message is generated by the Framework itself mostly in connection with the treatment of a catch statement. This takes almost no time (Microsoft suggests to ignore this message) but in a game environment it could eat up a frame every minute or so. I'll have a look at this because every tick counts in a game :)

Thanks for the finding!
#287
06/09/2010 (3:54 am)
Hey guys,

from what I can see almost all the fixes in the SVN repo for the Core and 2D engine have been included in the 3.1.5 Beta release. There are just a few exceptions (the AsyncLoader, the foreach statements and the ones highlighted in the dedicated bug submission thread.

I'd say that next official release will be a quite solid one :)
#288
06/09/2010 (6:41 am)
Howdy Pino,

I appear to be having the same memory leaks with my application I'm writing. I really appreciate your efforts to share fix with others.

Thanks,

Cain Neal
#289
06/09/2010 (7:53 am)
@Codog are you using the beta? The 3.1.4 release has the memory issues. I will have to check the beta but I believe from what I saw it does not.
#290
06/13/2010 (5:05 am)
Some new stuff that will be added to the repository tonight, see this thread (also for posting issues in the future!):

http://www.torquepowered.com/community/forums/viewthread/116577
#291
06/13/2010 (8:29 am)
hello all hope you are well. Pino, i tried to sign up for your site to see if i could access the file, the newsletter worked fine but i wasnt able to get the Async Loader, would you be so kind as to send me what needs to be done to my email: darc_bari at hotmail dot com. thanks so much and have a wonderful day.
#292
06/22/2010 (10:29 pm)
I've been a recent forum lurker/demo dabbler, and I finally got off my kiester and put down the cash to get the full version of Torque X.

I have two things I wanted to say:

1) Pino, you are an absolute hero of Torque X developers. I've heard one of my friends talking about your community development effort, and I've seen the evolving posts on the forum. You've done an amazing thing, and I think everyone who uses Torque X owes you a debt of gratitude.

2) Can I get access to the community Torque X projects now that I'm a full paid member? =)

Thanks!
#293
06/23/2010 (3:02 am)
Hey Alex,

welcome aboard! Thanks for the appreciation ;) I'll send you the invitations to the SVN repositories at the email address shown in your forum profile: you need to accept them all to get full access.

Cheers,
Pino
#294
06/23/2010 (5:45 pm)
Thanks! =)
#295
06/29/2010 (4:22 pm)
I haven't seen a message from you yet, have you been able to send it? Let me know if there's anything I can do to help! =)
#296
06/29/2010 (5:50 pm)
Alex, you are in the system waiting list, meaning that you didn't accept the invitation. I'll have them sent again, please check also your spam folder ;)
#297
06/29/2010 (6:47 pm)
Hi Pino,

I would like access to your repository. :)
#298
06/29/2010 (8:15 pm)
Ahh! Aye, I'll check it out, thanks! =)

Ah, I got it this time! Thank you Pino, you're a gentleman and a scholar. =)

Hopefully I can provide some help of my own on the project, if I can work on the game long enough to really start to figure out how this engine works... =(
Page«First 9 10 11 12 13 14 15 Next»