Question

I have an ivar, keys which is an NSMutableArray containing 50 strings. When my view loads, i am getting a zombie messaged error in Instruments, and it is directing me to this line of code:

for (int row = 0; row < r; row++) {
    for (int column = 0; column < c; column++){
        otherArray[column][row] = [[[keys objectAtIndex:0] retain] autorelease]; 
                                //^ Instruments brings me here
        [keys removeObjectAtIndex:0];
    }
}

I have retained the value to keep it alive so that the remove will not cause a crash, but it still does. I have tried not retaining, and autoreleasing and it still crashes. This method of retaining and autoreleasing works when i have a local variable, but not an ivar...

I need an ivar because i need to access the strings elsewhere.

Thanks

Was it helpful?

Solution 2

Solved -- Memory management problem - keys was not being correctly retained.

OTHER TIPS

synthesize it and release and it in your dealloc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top