Hi guys,
I have the following code inside an UIViewController :
When i generate a memory warning, this UIViewController's view will be unloaded. (i know it because i print out inside viewDidUnload method). The 'button' is still there, since we keep a reference to it.
The problem is, when the viewDidLoad is called again, we assign 'button' to a new UIButton created, then there should be a memory leak. But the Instruments app doesn't detect this leak.
I have no idea why. Any one ?
I have the following code inside an UIViewController :
Code:
- (void) viewDidLoad {
NSLog(@"viewDidLoad");
[super viewDidLoad];
button = [[UIButton alloc] init];
[self.view addSubview:button];
}
When i generate a memory warning, this UIViewController's view will be unloaded. (i know it because i print out inside viewDidUnload method). The 'button' is still there, since we keep a reference to it.
The problem is, when the viewDidLoad is called again, we assign 'button' to a new UIButton created, then there should be a memory leak. But the Instruments app doesn't detect this leak.
I have no idea why. Any one ?