views:

63

answers:

1

I have an app for iPhone in development which works properly when the Malloc guard is not enabled. However when i try to enable the malloc guard i get the following error after the app is loaded.

#0  0x95f65684 in objc_msgSend ()

#1 0x30506515 in NSPopAutoreleasePool ()

#2 0x30901697 in _UIApplicationHandleEvent ()

#3 0x32046375 in PurpleEventCallback ()

#4 0x30245560 in CFRunLoopRunSpecific ()

#5 0x30244628 in CFRunLoopRunInMode ()

#6 0x308f930d in -[UIApplication _run] ()

#7 0x309021ee in UIApplicationMain () Now my problem is that i am not able to debug the exact location where its getting the error.. have tried malloc_error_break but didnt work out. Is it that malloc guard enabling auto releases some of the objects based on allocation??

A: 

You're releasing some memory that's autoreleased. Without seeing any of your code it's difficult to say what exactly the problem is but it would look something like this:

NSString* aVar = [NSString stringWithFormat:@"Hello %@", worldVariable];

...

[aVar release];

This wouldn't crash at the release statement (as the reference count would be at least one) but would crash at some later point in the run loop where the autorelease pool is "drained."

Stephen Darlington
Thanks for the response. The code is a little huge (about 23 .m files) to fit in here. I shall try out ur suggestion and will see whats wrong.
Nareshkumar