If i create a simple class like this
@interface table : NSObject {
NSMutableArray *array;
}
@end
and in the Init method I call: array = [[NSMUtableArray alloc] init];
and in the dealloc method I call: [array release];
but I have a memory leek because the dealloc method is never called. I must call the dealloc method by myself?
When an object’s retain count hits 0 it is marked by the run time for cleanup. When the run time cleans up the object and reclaims the memory, dealloc is called giving it a chance to clean any other object references to instance variables or the like. Does that help? If you want to see it called, put
or a break point at the beginning of your dealloc method and watch the debugger/console.