memory leak in pushViewController
I'm new to memory management, and i've searched for similar topics, but didn't find such simple example causing memory leak. I'm testing my application with Instruments and it says I have memory leak of 144 Bytes in pushViewController.
rootViewController:
- (IBAction)optionsAction
{
optionsViewController *ovc = [[optionsViewController alloc] init];
// MEMORY LEAK 100.0%
[self.navigationController pushViewController:ovc animated:YES];
[ovc release];
}
optionsViewController.h
@interface optionsViewController : UIViewController <ADBannerViewDelegate> {
UISlider *volumeSlider;
UISwitch *soundSwitch;
SystemSoundID SSID;
}
@property (nonatomic, retain) IBOutlet UISwitch *soundSwitch;
@property (nonatomic, retain) IBOutlet UISlider *volumeSlider;
@property (assign) SystemSoundID SSID;
@end
optionsViewController.m
- (void)dealloc
{
[volumeSlider release];
[soundSwitch release];
AudioServicesDisposeSystemSoundID(self.SSID);
[super dealloc];
}
Have you any idea what could开发者_开发技巧 be the reason of this leak? Can you say where should I search for the problem, rootViewController or optionsViewController?
I think AppSoundEngine could simplify your life :) It is objective-c wrapper for system sounds, easy to use. You can handle sound play competence to dedicated class. Your view controller would be less stressed :)
精彩评论