Random crash : really need help from experienced Mac OSX programmer

Hello,

I just finished to port 2 of my games to Mac OSX from Windows/DirectX/D3D,
using SDL v1.2.12 + SDL_image v1.2.6 + SDL_mixer v1.2.8, with OpenGL for
display.
Unfortunately, both games get random crashes, sometimes just at start or
after a few minutes, sometimes after a hour, sometimes never. Unfortunately,
on my system, it seems to be never, so it’s not easy for me to debug and
find the cause.

I gathered a few crash reports I got here :
http://www.managames.com/crashreports.html

It seems the crash occures from the Cocoa event system, both with
nextEventMatchingMask & sendEvent, by wanting to reach an incorrect object
address, and thus crashing in objc_msgSend (or objc_msgSend_rtp).

My games are in C++, so I’m using only 2 obj-c sources (one being obj-c++),
I put them here :
http://www.managames.com/crash-mm-code.txt
The 1st one is the SDL default file. I tried both with and without using a
custom .Nib file.
The 2nd one is mainly used to add a custom menu with a few entries, but one
of my user reported me to get the bug, even after have disabled the creation
of this menu.

I got some few crash reports from within my code, and I already corrected
them, but it didn’t help to fix the random crashes…

On my system, I used NSZombieEnabled, CFZombie, MallocGuardEdges &
MallocScribble, without any result.
I have my own buffer overrun detection system in debug mode, and it didn’t
catch anything.

You can find my games here : http://www.managames.com

Anyone would have some idea where and how I should head my bug research ?

Thanks in advance…!

Hello again,

I forgot to say 2 important points :
1 - it still crashes with the sound off
2 - it seems to crash a lot more often in fullscreen than in windowed mode

manutoo wrote:

Hello,

I just finished to port 2 of my games to Mac OSX from Windows/DirectX/D3D,
using SDL v1.2.12 + SDL_image v1.2.6 + SDL_mixer v1.2.8, with OpenGL for
display.
Unfortunately, both games get random crashes, sometimes just at start or
after a few minutes, sometimes after a hour, sometimes never. Unfortunately,
on my system, it seems to be never, so it’s not easy for me to debug and
find the cause.

I gathered a few crash reports I got here :
http://www.managames.com/crashreports.html

It seems the crash occures from the Cocoa event system, both with
nextEventMatchingMask & sendEvent, by wanting to reach an incorrect object
address, and thus crashing in objc_msgSend (or objc_msgSend_rtp).

My games are in C++, so I’m using only 2 obj-c sources (one being obj-c++),
I put them here :
http://www.managames.com/crash-mm-code.txt
The 1st one is the SDL default file. I tried both with and without using a
custom .Nib file.
The 2nd one is mainly used to add a custom menu with a few entries, but one
of my user reported me to get the bug, even after have disabled the creation
of this menu.

I got some few crash reports from within my code, and I already corrected
them, but it didn’t help to fix the random crashes…

On my system, I used NSZombieEnabled, CFZombie, MallocGuardEdges &
MallocScribble, without any result.
I have my own buffer overrun detection system in debug mode, and it didn’t
catch anything.

You can find my games here : http://www.managames.com

Anyone would have some idea where and how I should head my bug research ?

Double check you follow the memory management rules:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html

The following two releases in GetOsxLanguage are bad:

[pPreferredLang release];
[pLanguages release];

Cheers,
Frank.–
Need a break? http://criticalmass.sf.net/

Hello,

At 13:06 10/08/2007, you wrote:

Double check you follow the memory management rules:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html

The following two releases in GetOsxLanguage are bad:

    [pPreferredLang release];
    [pLanguages release];

Ok thanks, I wasn’t sure, I didn’t have them at 1st, so I added them
later, but crashes occurred in both cases anyway.
I’m going to remove them now.

manutoo wrote:

Unfortunately, both games get random crashes, sometimes just at start or
after a few minutes, sometimes after a hour, sometimes never. Unfortunately,
on my system, it seems to be never, so it’s not easy for me to debug and
find the cause.

Some Cocoa-memory-management-related crashes within SDL were fixed after
the 1.2.12 release: http://bugzilla.libsdl.org/show_bug.cgi?id=458.
Your crash reports do not look related to this, but perhaps it can’t
hurt trying with a newer version from SVN anyway.

-Christian

Hello,

At 02:21 11/08/2007, you wrote:

Some Cocoa-memory-management-related crashes within SDL were fixed after
the 1.2.12 release: http://bugzilla.libsdl.org/show_bug.cgi?id=458.
Your crash reports do not look related to this, but perhaps it can’t
hurt trying with a newer version from SVN anyway.

Actually, regarding the comments, it seems pretty close of my
problem. I’m going to add only this bug fix, downloading the whole
SVN isn’t much safe…! :wink:

Hello,

I applied the patch, but now, some users still have some freezes but without any
crashes… :-S

manutoo wrote:

here one of my user’s console.log :

2007-08-18 08:48:22.368 Tennis Elbow 2006[277] Exception raised during posting
of notification. Ignored. exception: *** -[NSLayoutManager
glyphRangeForTextContainer:]: given container does not appear in the list of
containers for this NSLayoutManager.

Does this perchance happen when a key is pressed? I’m observing crashes
with the same error message occasionally when pressing the arrow keys in
SDL 1.3. It seems to have something to do with
http://libsdl.org/cgi/viewvc.cgi?view=rev&revision=3217.

-Christian