I'm getting EXC_BAD_ACCESS in random locations. Already tried to use NSZombieEnabled=YES but nothing different happens. I'm using xcode 4. Already tried: Enable Scribble, Enable Guard Edges, Enable Guard Malloc (only works at the simulator, very slow!), Memory Logging, and etc... No luck.
Anyone can suggest me another way to try to find the defect? I'm running out of options.
Thanks in Advance,
- New information
Inside: (void)applicationDidFinishLaunching:(UIApplication *)application
I create a Timer: ASMInterrupt = [NSTimer scheduledTimerWithTimeInterval:1/60.0 target:self selector:@selector(interrupiSSao:) userInfo:nil repeats:YES];
And a new thread: [NSThread detachNewThreadSelector: @selector(myBackgroundMethod: ) toTarget:self withObject:nil];
Timer will be in a loop until myBackgroundMethod is running.
Inside myBackgroundMethod I use:
//Beginning of the function
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
EAGLContext *context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES1 sharegroup: [[glView context] sharegroup]];
[EAGLContext setCurrentContext:context];
... //Several texture/sounds/music load, like this:
NSBundle *bundle = [NSBundle mainBundle];
sndMove = [[SoundFx alloc] initWithSound:[bundle pathForResource:@"tetMov" ofType:@"wav"]];
txParallax[0] = [[Texture2D alloc] initWithImageFile:@"parallax_tst" ofType : @"png" inMode:TEX_RGBA];
NSString *tmpSom = [[NSBundle mainBundle] pathForResource:@"ThorTitle" ofType:@"mp3"]; musMenu = [[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:tmpSom] error:NULL]retain];
...
//and at the end:
[EAGLContext setCurrentContext:nil];
[context release];
[pool release];
This only occur at the beginning of the app. And error always occurs after: 1) Long time playing 2) After game over and new game 3) At game over sequence
So, it might not be directly related to that thread. I tried to look for autorelease problems, but everything is allocated with initWith