Game Crashes - Any Thoughts?
Cluv
Member Posts: 229
My game crashes on one of its levels and it seems to do it after I spawn a certain number of actors. However, I am constantly creating and destroying actors in my app, so I am uncertain as to what might be causing it. I noticed that the memory slowly leaks up and up until it crashes. Does anyone else have a similar issue?:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x358c8a80 memmove$VARIANT$CortexA9 + 240
1 MathMoney 0x000294de 0x1000 + 165086
2 MathMoney 0x0001c5ea 0x1000 + 112106
3 MathMoney 0x00021326 0x1000 + 131878
4 MathMoney 0x000211c8 0x1000 + 131528
5 MathMoney 0x0002119a 0x1000 + 131482
6 MathMoney 0x00023068 0x1000 + 139368
7 MathMoney 0x00018f7a 0x1000 + 98170
8 MathMoney 0x00014f08 0x1000 + 81672
9 MathMoney 0x000189fc 0x1000 + 96764
10 MathMoney 0x0001911a 0x1000 + 98586
11 MathMoney 0x00014ee0 0x1000 + 81632
12 MathMoney 0x00028fc0 0x1000 + 163776
13 MathMoney 0x00025faa 0x1000 + 151466
14 MathMoney 0x00027024 0x1000 + 155684
15 MathMoney 0x000262d8 0x1000 + 152280
16 QuartzCore 0x37af706c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
17 QuartzCore 0x37af6fc4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
18 IOMobileFramebuffer 0x3312dfd4 IOMobileFramebufferVsyncNotifyFunc + 152
19 IOKit 0x33132446 IODispatchCalloutFromCFMessage + 190
20 CoreFoundation 0x382f45d8 __CFMachPortPerform + 116
21 CoreFoundation 0x382ff170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
22 CoreFoundation 0x382ff112 __CFRunLoopDoSource1 + 134
23 CoreFoundation 0x382fdf94 __CFRunLoopRun + 1380
24 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
25 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
26 GraphicsServices 0x3a41d2e6 GSEventRunModal + 70
27 UIKit 0x388e92fc UIApplicationMain + 1116
28 MathMoney 0x0002c1ba 0x1000 + 176570
29 MathMoney 0x000038f4 0x1000 + 10484
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3a37a648 kevent64 + 24
1 libdispatch.dylib 0x35b4f974 _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x35b4f654 _dispatch_mgr_thread$VARIANT$mp + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 CoreFoundation 0x382ff040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x382fdd9e __CFRunLoopRun + 878
4 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
6 WebCore 0x3a480a70 _ZL12RunWebThreadPv + 440
7 libsystem_c.dylib 0x358b930e _pthread_start + 306
8 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 CoreFoundation 0x382ff040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x382fdd9e __CFRunLoopRun + 878
4 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
6 Foundation 0x360b1bc8 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x36135678 __NSThread__main__ + 968
8 libsystem_c.dylib 0x358b930e _pthread_start + 306
9 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x3a38a594 __select + 20
1 CoreFoundation 0x383031f2 __CFSocketManager + 674
2 libsystem_c.dylib 0x358b930e _pthread_start + 306
3 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 5 name: AURemoteIO::IOThread
Thread 5:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 AudioToolbox 0x3b682624 AURemoteIO::IOThread::Run() + 104
3 AudioToolbox 0x3b68498c AURemoteIO::IOThread::Entry(void*) + 4
4 AudioToolbox 0x3b5c28a2 CAPThread::Entry(CAPThread*) + 294
5 libsystem_c.dylib 0x358b930e _pthread_start + 306
6 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 6 name: AQClient
Thread 6:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 CoreFoundation 0x382ff040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x382fdd9e __CFRunLoopRun + 878
4 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
6 AudioToolbox 0x3b5e15b6 GenericRunLoopThread::Entry(void*) + 134
7 AudioToolbox 0x3b5c28a2 CAPThread::Entry(CAPThread*) + 294
8 libsystem_c.dylib 0x358b930e _pthread_start + 306
9 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x07917a88 r2: 0xffffffc8 r3: 0xc62e90ce
r4: 0x00000000 r5: 0x07917a80 r6: 0x00000000 r7: 0x2fdfeb48
r8: 0x00000008 r9: 0x00007a00 r10: 0x00000008 r11: 0x00939640
ip: 0x00000000 sp: 0x2fdfeb40 lr: 0x000294e3 pc: 0x358c8a80
cpsr: 0x600f0010
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x358c8a80 memmove$VARIANT$CortexA9 + 240
1 MathMoney 0x000294de 0x1000 + 165086
2 MathMoney 0x0001c5ea 0x1000 + 112106
3 MathMoney 0x00021326 0x1000 + 131878
4 MathMoney 0x000211c8 0x1000 + 131528
5 MathMoney 0x0002119a 0x1000 + 131482
6 MathMoney 0x00023068 0x1000 + 139368
7 MathMoney 0x00018f7a 0x1000 + 98170
8 MathMoney 0x00014f08 0x1000 + 81672
9 MathMoney 0x000189fc 0x1000 + 96764
10 MathMoney 0x0001911a 0x1000 + 98586
11 MathMoney 0x00014ee0 0x1000 + 81632
12 MathMoney 0x00028fc0 0x1000 + 163776
13 MathMoney 0x00025faa 0x1000 + 151466
14 MathMoney 0x00027024 0x1000 + 155684
15 MathMoney 0x000262d8 0x1000 + 152280
16 QuartzCore 0x37af706c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
17 QuartzCore 0x37af6fc4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
18 IOMobileFramebuffer 0x3312dfd4 IOMobileFramebufferVsyncNotifyFunc + 152
19 IOKit 0x33132446 IODispatchCalloutFromCFMessage + 190
20 CoreFoundation 0x382f45d8 __CFMachPortPerform + 116
21 CoreFoundation 0x382ff170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
22 CoreFoundation 0x382ff112 __CFRunLoopDoSource1 + 134
23 CoreFoundation 0x382fdf94 __CFRunLoopRun + 1380
24 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
25 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
26 GraphicsServices 0x3a41d2e6 GSEventRunModal + 70
27 UIKit 0x388e92fc UIApplicationMain + 1116
28 MathMoney 0x0002c1ba 0x1000 + 176570
29 MathMoney 0x000038f4 0x1000 + 10484
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3a37a648 kevent64 + 24
1 libdispatch.dylib 0x35b4f974 _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x35b4f654 _dispatch_mgr_thread$VARIANT$mp + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 CoreFoundation 0x382ff040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x382fdd9e __CFRunLoopRun + 878
4 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
6 WebCore 0x3a480a70 _ZL12RunWebThreadPv + 440
7 libsystem_c.dylib 0x358b930e _pthread_start + 306
8 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 CoreFoundation 0x382ff040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x382fdd9e __CFRunLoopRun + 878
4 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
6 Foundation 0x360b1bc8 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x36135678 __NSThread__main__ + 968
8 libsystem_c.dylib 0x358b930e _pthread_start + 306
9 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x3a38a594 __select + 20
1 CoreFoundation 0x383031f2 __CFSocketManager + 674
2 libsystem_c.dylib 0x358b930e _pthread_start + 306
3 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 5 name: AURemoteIO::IOThread
Thread 5:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 AudioToolbox 0x3b682624 AURemoteIO::IOThread::Run() + 104
3 AudioToolbox 0x3b68498c AURemoteIO::IOThread::Entry(void*) + 4
4 AudioToolbox 0x3b5c28a2 CAPThread::Entry(CAPThread*) + 294
5 libsystem_c.dylib 0x358b930e _pthread_start + 306
6 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 6 name: AQClient
Thread 6:
0 libsystem_kernel.dylib 0x3a379eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a37a048 mach_msg + 36
2 CoreFoundation 0x382ff040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x382fdd9e __CFRunLoopRun + 878
4 CoreFoundation 0x38270eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x38270d44 CFRunLoopRunInMode + 100
6 AudioToolbox 0x3b5e15b6 GenericRunLoopThread::Entry(void*) + 134
7 AudioToolbox 0x3b5c28a2 CAPThread::Entry(CAPThread*) + 294
8 libsystem_c.dylib 0x358b930e _pthread_start + 306
9 libsystem_c.dylib 0x358b91d4 thread_start + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x07917a88 r2: 0xffffffc8 r3: 0xc62e90ce
r4: 0x00000000 r5: 0x07917a80 r6: 0x00000000 r7: 0x2fdfeb48
r8: 0x00000008 r9: 0x00007a00 r10: 0x00000008 r11: 0x00939640
ip: 0x00000000 sp: 0x2fdfeb40 lr: 0x000294e3 pc: 0x358c8a80
cpsr: 0x600f0010
Comments
Try to make your game screen double width, and put all the actors on the right out of the camera side and simply call them when needed and send them off screen when job is done, with move or interpolate or constrain attributes.
I am also stuck with scrolling background part of my game with this. I am not sure hows its going to work on ipad, haven't tested yet.
It totally depends on your game project, if you are making a puzzle or a game with tiles system, its will actually save some memory because that particular tile will be loaded in memory instead of assigning new memory to it.
I am not sure how it all works, just got my apple D license today, so soon going to try out and check which works best.
The crash/leak is being caused by turning on the physics on the object. If the physics are off, I have no problem. I have also turned off all functions inside the object so it is definitely caused by the objects themselves. The .pngs are twice as large as necessary for resolution independence. Anyone else dealing with a similar problem?
So I set all the physics options to 0 and that seemed to slow down the leak significantly. That is OK for the time being, but I want to make sure I can use the physics attributes if I want to. Anyone clued in to the problem?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
it is not memory … it is its memory allocation
i.e. the address in memory … the bytes location set to store the data of the actor
IMO
each spawn in a scene will allocate bytes to store each an instance of an actor
destroying the actor does NOT clean out the memory and free up those bytes
… it merely removes the actor from screenDisplay
each new spawn will generate a new location for bytes in memory
to clear memory of useless data and free it up for more stuff …
one needs a good garbage collection method … Lua's doesn't do that well
==
offScreen … recycling actors each only need one instance of memory allocation
much more efficient and faster … especially if Preload Art is unchecked
MH
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@fryingbaconstudios: I am in total agreement with your assessment about bad code, but when the leak still happened when I shut all my functions off in the object, that made me really wonder. It is directly linked to the number of physics attributes I use. I don't use any, no leak. 1, a little leak. 2, more, etc.
As for making the images smaller, in my iPhone version the images are substantially reduced, but the issue remains.
And, if I remove the object entirely, no leak!
I know I am not the most elegant coder, but I am certainly not the worst. I am at a loss for how the leak could be so significant when all I have are physics variables on.
I am sure I am probably coming across stubborn, and I really appreciate the suggestions, but could it be caused by anything else in my code?
Could it be if there is any transparency in my .png, that my cause extra memory to be allocated? Or, can I manually do a collide that circumvents gamesalad's one?
~ On a side note ~ I have removed enough of the physics variables to "fix" the problem for the time being. This discussion is more academic at this point and I really want to know what might be causing it. I will probably create a project that only has the object and nothing else and see what happens.
16 GraphicsServices 0x3a41d2e6 GSEventRunModal + 70
17 QuartzCore 0x37af706c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
26 QuartzCore 0x37af6fc4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
At least it should...
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS