FIXED: GDB: Program received signal: "0" & Memory Leak (iTGB 1.2)
by Rob Stiles · in iTorque 2D · 08/25/2009 (6:24 pm) · 46 replies
Hi,
I have the beginnings of a very basic platform game here. I've not modified the engine at all, I'm not allocating memory anywhere in script (other than local variables) and I'm execing my scripts all in one place in startGame() in game.cs, at the beginning of the game (not in a loop somewhere).
I'm using the regular iTGB build target, either in Release or Debug. If I run the game and leave it, it'll crash after about 4 minutes. The debugger just says "GDB: Program received signal: "0"".
If I open Organizer in Xcode and choose the Console tab I see this:
Tue Aug 25 21:52:15 unknown SpringBoard[23] <Warning>: Memory level is urgent (9%) and there are no background apps to ask to exit.
Tue Aug 25 21:53:18 unknown SpringBoard[23] <Warning>: Application 'MyGame' exited abnormally with signal 11: Segmentation fault
Tue Aug 25 21:53:19 unknown ReportCrash[4565] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2009-08-25-215318.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
The crash report shows this:
Incident Identifier: 045BD190-D071-4AFE-B9A6-774503A8F8C3
CrashReporter Key: 5fd95a1e842ebce7c3a80c9d86ed697359c11367
OS Version: iPhone OS 3.0.1 (7A400)
Date: 2009-08-25 21:53:18 +0100
Free pages: 251
Wired pages: 8773
Purgeable pages: 0
Largest process: MyGame
Processes
Name UUID Count resident pages
securityd <8266b85008779d1e28f2509e51d303cf> 90
MyGame <73c36f64f5d4332638d08e312ea9aa84> 11744 (jettisoned) (active)
debugserver <b79865bab3ea06747ce03eaa9f7b7a8f> 109
DTMobileIS <a541ccb799a4e87cb10636268ab1b87b> 1238
notification_pro <09df4bf987a6baaa3e77192c4026bc5e> 61
syslog_relay <4adc9d69d534cb0be0649055b2188c4e> 62
notification_pro <09df4bf987a6baaa3e77192c4026bc5e> 62
notification_pro <09df4bf987a6baaa3e77192c4026bc5e> 62
afcd <08d114ca35c3e862bdb56df371c5d197> 64
ptpd <e1c6f82741b354c1086e373473131824> 172
MobilePhone <9517d3db1b487371c5a64e41bfd19eda> 589 (jettisoned)
debugserver <b79865bab3ea06747ce03eaa9f7b7a8f> 82
debugserver <b79865bab3ea06747ce03eaa9f7b7a8f> 82
mediaserverd <cc588f963f30bd34296bf8beeb803f8a> 435
SCHelper <fb330a127ccd71984188d2ce28d62716> 94
BTServer <3ae1c6fbcb29741b4a609b02f3c5a127> 178
iapd <3204da63503dec0812fa062678c61743> 246
notifyd <69e04d13344f1c006227422dbf18dde8> 108
CommCenter <e2b77989cdd88779b25322e1ef82b126> 419
SpringBoard <e0166bb2d42cbc489ace07849c959088> 2987 (active)
configd <2950435c092830011e402b4ac8ea86fe> 71
configd <2950435c092830011e402b4ac8ea86fe> 295
fairplayd <ec3c2c10efbb2e7a7b9d7130ecb1e2c6> 73
IQAgent <0c8ec49a509e684ffd4cae7729e2dcc9> 155
mDNSResponder <21273afce237d1ff8e79ab819a130e3c> 110
lockdownd <374e220ffb0f06ac0f7aa024a979e31f> 366
syslogd <4eae063fb35192e82cf5c47df1063443> 83
launchd <09ab79ab1b390e1fee1309f58948f17c> 105
**End**
It seems fairly obvious it's a memory leak but where from? I'm hoping other people here have had the same problem and fixed it - it must be a common thing since i'm using a virgin iTGB 1.2. I've only just bought it and I promise I've not changed any source code!
I have the beginnings of a very basic platform game here. I've not modified the engine at all, I'm not allocating memory anywhere in script (other than local variables) and I'm execing my scripts all in one place in startGame() in game.cs, at the beginning of the game (not in a loop somewhere).
I'm using the regular iTGB build target, either in Release or Debug. If I run the game and leave it, it'll crash after about 4 minutes. The debugger just says "GDB: Program received signal: "0"".
If I open Organizer in Xcode and choose the Console tab I see this:
Tue Aug 25 21:52:15 unknown SpringBoard[23] <Warning>: Memory level is urgent (9%) and there are no background apps to ask to exit.
Tue Aug 25 21:53:18 unknown SpringBoard[23] <Warning>: Application 'MyGame' exited abnormally with signal 11: Segmentation fault
Tue Aug 25 21:53:19 unknown ReportCrash[4565] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2009-08-25-215318.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
The crash report shows this:
Incident Identifier: 045BD190-D071-4AFE-B9A6-774503A8F8C3
CrashReporter Key: 5fd95a1e842ebce7c3a80c9d86ed697359c11367
OS Version: iPhone OS 3.0.1 (7A400)
Date: 2009-08-25 21:53:18 +0100
Free pages: 251
Wired pages: 8773
Purgeable pages: 0
Largest process: MyGame
Processes
Name UUID Count resident pages
securityd <8266b85008779d1e28f2509e51d303cf> 90
MyGame <73c36f64f5d4332638d08e312ea9aa84> 11744 (jettisoned) (active)
debugserver <b79865bab3ea06747ce03eaa9f7b7a8f> 109
DTMobileIS <a541ccb799a4e87cb10636268ab1b87b> 1238
notification_pro <09df4bf987a6baaa3e77192c4026bc5e> 61
syslog_relay <4adc9d69d534cb0be0649055b2188c4e> 62
notification_pro <09df4bf987a6baaa3e77192c4026bc5e> 62
notification_pro <09df4bf987a6baaa3e77192c4026bc5e> 62
afcd <08d114ca35c3e862bdb56df371c5d197> 64
ptpd <e1c6f82741b354c1086e373473131824> 172
MobilePhone <9517d3db1b487371c5a64e41bfd19eda> 589 (jettisoned)
debugserver <b79865bab3ea06747ce03eaa9f7b7a8f> 82
debugserver <b79865bab3ea06747ce03eaa9f7b7a8f> 82
mediaserverd <cc588f963f30bd34296bf8beeb803f8a> 435
SCHelper <fb330a127ccd71984188d2ce28d62716> 94
BTServer <3ae1c6fbcb29741b4a609b02f3c5a127> 178
iapd <3204da63503dec0812fa062678c61743> 246
notifyd <69e04d13344f1c006227422dbf18dde8> 108
CommCenter <e2b77989cdd88779b25322e1ef82b126> 419
SpringBoard <e0166bb2d42cbc489ace07849c959088> 2987 (active)
configd <2950435c092830011e402b4ac8ea86fe> 71
configd <2950435c092830011e402b4ac8ea86fe> 295
fairplayd <ec3c2c10efbb2e7a7b9d7130ecb1e2c6> 73
IQAgent <0c8ec49a509e684ffd4cae7729e2dcc9> 155
mDNSResponder <21273afce237d1ff8e79ab819a130e3c> 110
lockdownd <374e220ffb0f06ac0f7aa024a979e31f> 366
syslogd <4eae063fb35192e82cf5c47df1063443> 83
launchd <09ab79ab1b390e1fee1309f58948f17c> 105
**End**
It seems fairly obvious it's a memory leak but where from? I'm hoping other people here have had the same problem and fixed it - it must be a common thing since i'm using a virgin iTGB 1.2. I've only just bought it and I promise I've not changed any source code!
About the author
#42
Do you want me to take a look at your project? That might be easier than me trying to guess possible reasons... send me an email at dave@cerulean-games.com and an NDA if you need it and I'll load things up and take a peek.
10/05/2009 (6:37 pm)
Mike,Do you want me to take a look at your project? That might be easier than me trying to guess possible reasons... send me an email at dave@cerulean-games.com and an NDA if you need it and I'll load things up and take a peek.
#43
I hope you have found a solution for this as I have tried all the options for last 3 days and still no joy. At the moment i feel buying iTGB was the biggest mistake. I wrote to GG and all they said tht they dont have this issues, so basically they cant do much. It is really disappointing and frustrating to pay $500 for a product which doesnt function properly. I hope someone can help me with this.
10/14/2009 (7:01 pm)
I am having this issue as well. Whenever I use the Optimize and Script Change options my game builds fine but never loads on the iphone. It shuts down in 3 to 4 secs. And without these options my game works fine for 19mins and then shuts down. I looked in the logs and as expexted it was complaining about memory. I hope you have found a solution for this as I have tried all the options for last 3 days and still no joy. At the moment i feel buying iTGB was the biggest mistake. I wrote to GG and all they said tht they dont have this issues, so basically they cant do much. It is really disappointing and frustrating to pay $500 for a product which doesnt function properly. I hope someone can help me with this.
#44
I'm not a dedicated iPhone or Mac dev and have only tested simple programs so I haven't run into the memory leak issue you're seeing after 20 minutes with a more complex program. I try to help out when I can, but I couldn't replicate it with my setup. It's a pretty vanilla setup.
Hopefully others will be able to get you past the problem.
10/14/2009 (8:41 pm)
@HiteshI'm not a dedicated iPhone or Mac dev and have only tested simple programs so I haven't run into the memory leak issue you're seeing after 20 minutes with a more complex program. I try to help out when I can, but I couldn't replicate it with my setup. It's a pretty vanilla setup.
Hopefully others will be able to get you past the problem.
#45
You can look for the problems in your game's memory usage by running the game through instruments.
In XCode : Menu Bar-> Run -> Start with performance tool -> Leaks.
It will look something like this when there is a leak (intentional leak added for dramatic effect) :

This will show you if there ARE memory leaks, or if your app is doing something it shouldn't. When you select the "Leaks" bar, not the object allocations bar, the extended view becomes populated with a call stack (once a leak has been selected). This will show you exactly which file, and which line of code is the code that is leaking memory. You need to "show extended view" to see the files and the callstack in which the leak originated.
The key to developing on a platform that is new to you is to learn the tools at hand before attempting or blaming other things for problems you face. There are a WEALTH of articles all over the internet about memory issues faced on iphone , and the best practices when using the iPhone as a development platform.
Keep in mind the following :
1. The iphone/ipod touches are a mobile device.
2. Apple has strict rules about application usability (the OS enforces them, see point a) below).
3. Memory on the iPhone is the biggest stumbling block that EVERYBODY hits. Its not just you, and its not specific to TGB either. This is not to say TGB doesn't have its problems (nobody is saying that), but i need to point this out first. The apple documents talk more about memory management in apps than on any other platform i have seen.
4. Just because there is a memory leak, doesn't mean the application wont run, and it doesn't mean that it cannot be fixed! If you see a leak in the engine, PLEASE do point it out (i run games through leaks more than i do in the simulator).
Something to remember :
a) Startup Times.
If an application "is taking too long to load", the OS will NOT allow the application to run. This is not a limitation of the engine, it is the way you are using the engine in practice. I had to redo a LOT of stuff more than once to get the app to startup without being connected to the debugger. Looking at other successful games using the same engine, on the same platform, who faced the exact same problems, makes me want to remind you to look closer at the solutions already at hand, and to utilise every tool and every bit of advice offered on the platform first - before giving up and most importantly, before blaming a particular part of your toolchain.
I hope this helps, and if you do find leaks please, let us know. And if you need more information on the tools available, feel free to ask.
10/15/2009 (9:31 am)
Hitesh and others : You can look for the problems in your game's memory usage by running the game through instruments.
In XCode : Menu Bar-> Run -> Start with performance tool -> Leaks.
It will look something like this when there is a leak (intentional leak added for dramatic effect) :

This will show you if there ARE memory leaks, or if your app is doing something it shouldn't. When you select the "Leaks" bar, not the object allocations bar, the extended view becomes populated with a call stack (once a leak has been selected). This will show you exactly which file, and which line of code is the code that is leaking memory. You need to "show extended view" to see the files and the callstack in which the leak originated.
The key to developing on a platform that is new to you is to learn the tools at hand before attempting or blaming other things for problems you face. There are a WEALTH of articles all over the internet about memory issues faced on iphone , and the best practices when using the iPhone as a development platform.
Keep in mind the following :
1. The iphone/ipod touches are a mobile device.
2. Apple has strict rules about application usability (the OS enforces them, see point a) below).
3. Memory on the iPhone is the biggest stumbling block that EVERYBODY hits. Its not just you, and its not specific to TGB either. This is not to say TGB doesn't have its problems (nobody is saying that), but i need to point this out first. The apple documents talk more about memory management in apps than on any other platform i have seen.
4. Just because there is a memory leak, doesn't mean the application wont run, and it doesn't mean that it cannot be fixed! If you see a leak in the engine, PLEASE do point it out (i run games through leaks more than i do in the simulator).
Something to remember :
a) Startup Times.
If an application "is taking too long to load", the OS will NOT allow the application to run. This is not a limitation of the engine, it is the way you are using the engine in practice. I had to redo a LOT of stuff more than once to get the app to startup without being connected to the debugger. Looking at other successful games using the same engine, on the same platform, who faced the exact same problems, makes me want to remind you to look closer at the solutions already at hand, and to utilise every tool and every bit of advice offered on the platform first - before giving up and most importantly, before blaming a particular part of your toolchain.
I hope this helps, and if you do find leaks please, let us know. And if you need more information on the tools available, feel free to ask.
#46
10/15/2009 (9:54 am)
Thanks a lot Sven for your reply. I will give this a go. Hopefully I this will give me clue where i am going wrong.
Torque Owner Mike Moore
I'm using 4.2 as well. Since upgrading to Snow Leopard, not been able to compile using 4.0