How UIWindow#addSubview can make memory leak?
Posted
by Jakub
on Stack Overflow
See other posts from Stack Overflow
or by Jakub
Published on 2010-06-08T14:00:36Z
Indexed on
2010/06/08
18:52 UTC
Read the original article
Hit count: 433
Hello,
I started to learn using Instrument, but I cannot figure it out. After I start my application, the UI shows up, I do nothing and after few seconds I can see memory leak detected:
When I have a look at the second leak I can see the following stack:
When I double click on the cell related to my code I can see that it is pointing to the following line of code:
[window addSubview:newPostUIViewController.view];
from the method:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//creating view controller
newPostUIViewController = [[NewPostUIViewController alloc] initWithNibName:@"NewPostView" bundle:nil];
newPostUIViewController.title = @"Post it!";
[window addSubview:newPostUIViewController.view];
// Override point for customization after application launch
[window makeKeyAndVisible];
}
I wonder, how this can be a reason of a leak? I release newPostUIViewController in the dealloc method of PostItAppDelegate class.
Any ideas how this could be explained?
© Stack Overflow or respective owner