• 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: Intercepting retain/release of object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intercepting retain/release of object


  • Subject: Re: Intercepting retain/release of object
  • From: "Sherm Pendley" <email@hidden>
  • Date: Fri, 21 Mar 2008 17:36:09 -0400

On Fri, Mar 21, 2008 at 4:32 PM, Stuart Malin <email@hidden> wrote:

> Thanks for all the comments. I had started this thread not because I
> wanted to peak under the hood, or employ non-canonical techniques,
> but because I had an instance become free before its time. I had
> though that intercepting -release (and also -retain, why not), would
> allow me to find the place where the extra release came from.


That's basically the kind of mistaken approach to debugging that I was
referring to.

When you find yourself facing an "extra" release, the $64k question is where
in your code are you failing to -retain an object that you will need later.
When your memory management is wrapped up in accessor methods, that becomes
a very simple question to answer.

In short, the fact that you need a means to track down your -retain and
-release calls is indicative of a deeper problem. Examining the retain count
will not only fail to solve that problem, but will also obfuscate the issue
even further. You'd be far better off asking yourself why your -retains and
-releases are so scattered that they're difficult to find and verify in the
first place - that's the *real* problem, not whatever arbitrary value you
happen to get back from -retainCount.

IMHO, of course. :-)

sherm--
_______________________________________________

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

  • Follow-Ups:
    • Re: Intercepting retain/release of object
      • From: Jack Repenning <email@hidden>
References: 
 >Re: Intercepting retain/release of object (From: Stuart Malin <email@hidden>)
 >Re: Intercepting retain/release of object (From: Scott Ribe <email@hidden>)
 >Re: Intercepting retain/release of object (From: "Sherm Pendley" <email@hidden>)
 >Re: Intercepting retain/release of object (From: Stuart Malin <email@hidden>)

  • Prev by Date: Re: Correct use of NSViewController
  • Next by Date: Re: NIB files on 10.1
  • Previous by thread: Re: Intercepting retain/release of object
  • Next by thread: Re: Intercepting retain/release of object
  • Index(es):
    • Date
    • Thread