Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Monday, December 14, 2009

My malloc double free errors and the solution

Monday, December 14, 2009   

After some time developing, I decided to check the debugger panel. And noticed that I was receiving several malloc double free errors in my iPhone application. Oops. They were not crashing the application, so I didn't notice them.

My problem:
I was calling up a view, and the logic to close the view after a method call providing an animation was the culprit. But I wasn't exactly sure why.
- (void) killMe:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    [self.view removeFromSuperview];
}
I had methods creating objects using init and I was releasing them in the view after use. However, that removeFromSuperview was cleaning up everything for me and thus I was receiving the double free errors. All I did was comment the releases out, let the removeFromSuperview do it's thing, and no more errors.
 
 Return to the main page
Comments:

There are currently 0 Comments:

 Leave a comment