0

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: alt text

When I have a look at the second leak I can see the following stack: alt text

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?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jakub
  • 3,129
  • 8
  • 44
  • 63

2 Answers2

0

You did not provide an autorelease or release to balance your init. Just in case you haven't read through it already, have a look at the memory management guide is a great help.

slf
  • 22,595
  • 11
  • 77
  • 101
  • Thanks for your suggestion, however, I release both newPostUIViewController and window in the dealloc method of PostItAppDelegate. Should I call the release in some other place? – Jakub Jun 08 '10 at 16:26
  • @Jakub can you post some more code showing how you use the controller? It's possible that the controller has an extra retain, but not on that line. – slf Jun 09 '10 at 13:10
0

Looking at link text allows to say that this is Simulator problem, not the code problem.

Community
  • 1
  • 1
Jakub
  • 3,129
  • 8
  • 44
  • 63