In my app, Leaks is reporting that it is leaking in these 3 areas:
1
NSData *data = [theDictionary objectForKey:@"Item1"];
[image setImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
2
The third line in this code
CGRect frame = self.view.frame;
frame.origin.x = CGRectGetMaxX(frame);
view3.view.frame = frame;
[self.view.superview addSubview:view3.view];
[UIView animateWithDuration:2
animations:^{
CGRect frame = self.view.frame;
view3.view.frame = frame;
frame.origin.x -= frame.size.width;
self.view.frame = frame;
}
completion:^(BOOL finished){
[self.view removeFromSuperview];
[self release];
}];
3
The first line in this code:
[self.view.superview addSubview:nlView.view];
[nlView.view setFrame:CGRectMake(-kWidth, 0, kWidth, kHeight)];
[UIView animateWithDuration:2.0
animations:^{
[nlView.view setFrame:CGRectMake(0, 0, kWidth, kHeight)];
[self.view setFrame:CGRectMake(kWidth, 0, kWidth, kHeight)];
}
completion:^(BOOL finished){
[self.view removeFromSuperview];
[self release];
}];
I might have fixed the first one by doing [image release]; afterwards but I do not think that is the right way to do it.
For 2 and 3, I don’t even see any leaks from my perspective even though Leaks says there are.
Can anyone show me where and how to fix these leaks?
Thanks!
I guess that you did not clean up nlView and view3.