Reputation: 18508
I am trying to find out why when creating an UIButton in interface builder - a memory leak occurs when running the instruments application by xcode.
This is how I created the memory leak.
I opened a new application, opened up the myAppViewController.xib file in interface builder. I changed the background to black. Added a UIButton, renamed it to "foo" title. saved and then exit.
In the myAppViewController.h file i have the following
#import <UIKit/UIKit.h>
@interface miPlanNewViewController : UIViewController {
IBOutlet UIButton *tasksProjects;
}
@property(nonatomic, retain) IBOutlet UIButton *tasksProjects;
@end
in the myAppViewController.m file i have the following:
#import "miPlanNewViewController.h"
@implementation miPlanNewViewController
@synthesize tasksProjects;
...
//the normal methods you get
...
- (void)dealloc {
[super dealloc];
}
@end
Here is a screen shot of what I am getting at the moment in instruments.
One thing i notice however....
I haven't connected the Outlet to the uibutton yet in interface builder, BUT when I delete the UIButton from interface builder, save, and then run the program with instruments again, I dont get any sort of leaks at all.
Can someone please explain what is happening and how I can solve this issue. Thank you.
Upvotes: 4
Views: 845
Reputation: 2234
[tasksProjects release];
and in viewDidUnload you should have self.taskProjects = nil;
Upvotes: 2