Hi All,
I'm currently having a problem where the leaks tool is reporting a slew of memory leaks after clicking on cells within a UITableView and then hitting the back button and popping off the view.
Majority of the leaks reported can not be traced back to any specific location in my code, they are:
Leaked Object # Address Size Responsible Library Responsible Frame
NSCFArray 2 < multiple > 64 UIKit -[UITouch(UITouchInternal)
UITouch 2 < multiple > 128 GraphicsServices PurpleEventCallback
Malloc 48 Bytes 2 < multiple > 96 Foundation -[NSCFArray insertObject:atIndex:]
UIDelayedAction 2 < multiple > 96 UIKit -[UILongPressGestureRecognizer startTimer]
NSCFArray 2 < multiple > 64 UIKit -[UILongPressGestureRecognizer touchesBegan:withEvent:]
Malloc 32 Bytes 2 < multiple > 64 Foundation -[NSCFArray insertObject:atIndex:]
Malloc 16 Bytes 2 < multiple > 32 Foundation -[NSCFSet unionSet:]
Now I have commented out all my code in any touch event functions that I have written and it still leaks if I click on the cell a few times and then hit the back button to return to the previous view.
Any ideas on what might actually be the problem here?
Thanks,
EDIT: Including code
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
name = [[UILabel alloc] initWithFrame:CGRectMake(40, 18, 153, 21)];
name.font = [UIFont boldSystemFontOfSize:14];
name.textAlignment = UITextAlignmentCenter;
name.backgroundColor = [UIColor clearColor];
name.textColor = [UIColor blackColor];
name.opaque = NO;
[self.contentView addSubview:name];
description = [[UILabel alloc] initWithFrame:CGRectMake(40, 35, 153, 21)];
description.font = [UIFont boldSystemFontOfSize:14];
description.textAlignment = UITextAlignmentCenter;
description.backgroundColor = [UIColor clearColor];
description.textColor = [UIColor blackColor];
description.opaque = NO;
[self.contentView addSubview:description];
category = [[UILabel alloc] initWithFrame:CGRectMake(40, 1, 153, 21)];
category.font = [UIFont boldSystemFontOfSize:12];
category.textAlignment = UITextAlignmentCenter;
category.backgroundColor = [UIColor clearColor];
category.textColor = [UIColor blackColor];
category.opaque = NO;
[self.contentView addSubview:category];
favorite = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
CGRect favFrame = CGRectMake(5, 4, 42, 52);
[favorite addTarget:self action:@selector(toggleFavoriteBtn:) forControlEvents:UIControlEventTouchUpInside];
[favorite setImage:[g_imageCacher getCachedImage:@"favorite_star_empty.png"] forState:UIControlStateNormal];
[favorite setImage:[g_imageCacher getCachedImage:@"favorite_star_selected.png"] forState:UIControlStateSelected];
favorite.backgroundColor = [UIColor clearColor];
favorite.frame = favFrame;
[self.contentView addSubview:favorite];
checkMark = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
CGRect ckFrame = CGRectMake(201, 23, 32, 32);
//[checkMark addTarget:self action:@selector(toggleFavoriteBtn:) forControlEvents:UIControlEventTouchUpInside];
[checkMark setImage:[g_imageCacher getCachedImage:@"check_empty.png"] forState:UIControlStateNormal];
[checkMark setImage:[g_imageCacher getCachedImage:@"check_filled.png"] forState:UIControlStateSelected];
checkMark.backgroundColor = [UIColor clearColor];
checkMark.frame = ckFrame;
[self.contentView addSubview:checkMark];
deleteButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
CGRect deleteFrame = CGRectMake(183, 0, 64, 64);
//[checkMark addTarget:self action:@selector(toggleFavoriteBtn:) forControlEvents:UIControlEventTouchUpInside];
[deleteButton addTarget:self action:@selector(deleteItem:) forControlEvents:UIControlEventTouchUpInside];
[deleteButton setImage:[g_imageCacher getCachedImage:@"delete_item.png"] forState:UIControlStateNormal];
deleteButton.backgroundColor = [UIColor clearColor];
deleteButton.frame = deleteFrame;
deleteButton.hidden = YES;
[self.contentView addSubview:deleteButton];
couponView = [[UIImageView alloc] initWithFrame:CGRectMake(199, 4, 32, 16)];
couponView.image = [g_imageCacher getCachedImage:@"coupon_small32x16.png"];
couponView.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:couponView];
self.selectionStyle = UITableViewCellSelectionStyleNone;
ApplicationAppDelegate *appDelegate = (ApplicationAppDelegate *)[[UIApplication sharedApplication] delegate];
itemMap = appDelegate.ItemMap;
currentInsertIndexPaths = appDelegate.indexPaths;
gItem = nil;
}
return self;
}
- (void)dealloc {
[name release];
[description release];
[category release];
[favorite release];
[checkMark release];
[couponView release];
[deleteButton release];
[super dealloc];
}