views:

131

answers:

1

I've been using this code to create my UIWindow

UIMyWindow* win = [[UIMyWindow alloc] 
                   initWithFrame:[[UIScreen mainScreen] applicationFrame]];

UIMyWindow isn't anything special it just has a pointer to a C++ class that does some wrapping of ObjectiveC.

Recently my application start crashing after adding some line of code that doesn't have to do anything with the error. The line of code that I added is just allocating a C++ object but the program execution never reaches this line.

Interesting enough my code works in Release.

My only guess is that I made some memory corruption on a completely different place. My questions are: What type of memory corruption that can be? And is there some good practices to track them down?

+1  A: 

You certainly have a message that is send to a deallocated object.

You should try to debug your program with Instruments.app. It should show you the potential memory problems.

Also take a look at the NSZombieEnabled environment variable. Basically, it leaves a dummy object at the place of the deallocated object. You'll be alerted when a message is send to that dummy object, allowing you to see where the problem is located.

Macmade
I just noticed I have this message in the log:Warning: the current language does not match this frame.NSZombieEnabled didn't help. My Instruments.app stopped working last time I updated the DevEnv or maybe it doesn't work because I have been testing only on iPad. I'll try to get my app on iPhone if it doesn't work out I may try updating the DevEnv.
Aleks