Re: Intercepting retain/release of object
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