iOS Why does this method leak?

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
8,615
4,086
When I attempt to build and run with absolutely nothing, Instruments reports no leaks.

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
}
When I attempt to build and run just this, Instruments reports a single leak.

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
   navigationController = [[UINavigationController alloc] init];
   [window addSubview:navigationController.view];
}
When I attempt to build and run this, I still get a single leak.

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
   navigationController = [[UINavigationController alloc] init];
   [window addSubview:navigationController.view];
   [navigationController release];
   [window release];
}
What is leaking in the second and third bit of code? The third example releases everything, so I don't understand how it's possible for it to leak anything.

It says the responsible library is CoreGraphics and the responsible frame is "open_handle_to_dylib_path".
 

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
8,615
4,086
do you have anything connected via IB? Is the navigation controller set as an outlet there?
No.

I do have a full program that actually does stuff, but it had two leaks. I found and fixed one of them. The other one I couldn't find so I finally decided to try commenting out portions of code. Eventually I got down to just those two lines. Running just that will cause instruments to report a leak. Commenting those out has no leaks reported. Trying to release everything still leaves a leak. So...

IDK, have I found a leak in Apple's code?
 
Comment

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
What is it that leaks tells you is leaking?

When does leaks tell you that a leak happened? When this method is run or some time later?
 
Comment

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
8,615
4,086
What is it that leaks tells you is leaking?

When does leaks tell you that a leak happened? When this method is run or some time later?
After the screen changes from black.

And I realized that I was mistaken in answering the first question, there is a NIB that was automatically created with the project. I never changed anything about it... my interface is handled all programmatically.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.