Search code examples
iphoneiosxcode-instruments

Xcode/Instruments/Leaks: can it show a red line where apparently there is no leak?


What the program is doing is simply allocating an object and then releasing it.

I'm new to Instruments so I'm not sure I'm interpetingh this right:

Instruments screenshot

The red line suggests there is a leak at the point where I allocate that object. But on the details you can see it was released and the refcount went back to 0. So why is there a red line in the first place, what is it exactly telling me?

EDIT: this is the "leak" detected. Code from my UIViewController:

- (void)viewDidLoad
{
    [super viewDidLoad];

    Plant *plant = [[Plant alloc] initWithWeight:3 withSpecies:@"carrot"];

    [plant release];
}

Solution

  • I found it.

    The class had a dealloc method that wasn't calling [super dealloc] at the end.