I'm still trying to find my way through memory management for the iPhone SDK, and I'm not sure why Instruments is reporting a certain block of code as a memory leak. I've followed tutorials for these parts of the code, so I'm not really sure what I'm doing wrong.
The violating block of code:
DreamTableCell *cell = (DreamTableCell *)[tableView dequeueReusableCellWithIdentifier:cellID];
if ( cell == nil )
cell = [[[DreamTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellID] autorelease];
Also, there is a custom method of DreamTableCell where the UITableViewCell's NIB file is loaded, nothing abnormal, as far as I know:
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
NSArray *objs = [[NSBundle mainBundle] loadNibNamed:@"DreamTableCell" owner:nil options:nil];
for ( id item in objs )
if ( [item isKindOfClass:[DreamTableCell class]] ) {
self = item;
break;
}
return self;
}
What's causing the memory leak here - what am I missing?