On Nov 18, 2011, at 9:23 AM, Richard Somers wrote:

> The normal pattern for Interface Builder Outlets is assign but I have an 
> outlet that must be retained to work corectly. The outlet is not in File's 
> Owner but is in a custom view in a window.
> 
> // Interface
> @property (retain) IBOutlet NSArrayController *myController;
> 
> // Implementation
> @synthesize myController = _myController
> 
> The application runs fine with no memory leaks reported by Instruments so I 
> assume that the frameworks are releasing myController.


SOLVED - Mac OS X Retained Outlet

Thanks for everyones comments. Here is what I have learned.

The frameworks will not release a retained outlet (assuming top-level objects 
are handled correctly). You are responsible for releasing it. A retained outlet 
is considered ownership and so you must release it.

If you do not release it, it will be alive in memory even though Instruments 
may not report it as a leak. For my particular case the outlet was actually a 
subclass of NSArrayController. Instruments reports the responsible caller as 
-[NSClassSwapper initWithCoder:]. I am not an expert in leaks but it appears 
that a reference to the outlet is maintained by the frameworks until the outlet 
is fully released and so Instruments does not report it as a leak.

--Richard

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to