views:

78

answers:

1

This is the header:

@interface ForumBrowserAppDelegate : NSObject <UIApplicationDelegate> {
 ForumSelection *forumSelection;
UIWindow *window;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ForumSelection *forumSelection;

(I'm not sure what the nonatomic does, is it something to do with making it safe with multiple threads, do i really need it?)

In the main file:

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    // Override point for customization after app launch   

    [window addSubview:forumSelection.view]; //<<<< Instruments highlights this line
    [forumSelection release];
    [window makeKeyAndVisible]; 
}  

Originally I didn't have the property thing in the header or the [forumSelection release]; So I thought that might be why it leaks however Instruments still says this leaks and I have no idea why?

A: 

you should not release it where you are doing, instead move the release to dealloc - its not "yours" to release - it was unpacked from the XIB. Doesn't explain the leak.

Are you sure the leak is not in forumSelection ?

Andiih
That's were I had the release before I moved it straight after the addSubView but it still told me there was a leak. If the leak was in forumSelection wouldn't instruments take me to the line in that class?
Jonathan
are you using instruments in hierarchical mode (second option on the bottom selector thingy) ? Are you drilling all the way down to find the last place your code is referenced, rather than the first ? (Click the error then Alt right-arrow if my memory serves me, which it might not)
Andiih
otherwise, its worth bearing in mind that instruments lies. Use it to find mistakes. If there isn't an error in your code, then you are probably OK. Have you tried the static analysis (Build and analyze ?)
Andiih