• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Retained Outlet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retained Outlet


  • Subject: Re: Retained Outlet
  • From: Richard Somers <email@hidden>
  • Date: Fri, 18 Nov 2011 15:57:56 -0700

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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Retained Outlet (From: Richard Somers <email@hidden>)

  • Prev by Date: Re: ARC and NSNib: How to release top-level objects?
  • Next by Date: CoreData and Threading
  • Previous by thread: Re: Retained Outlet
  • Next by thread: Cannot modify autoresizing with some iOS views
  • Index(es):
    • Date
    • Thread