FROM : Sherm Pendley
DATE : Fri Mar 21 22:36:09 2008
On Fri, Mar 21, 2008 at 4:32 PM, Stuart Malin <<email_removed>> 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--
DATE : Fri Mar 21 22:36:09 2008
On Fri, Mar 21, 2008 at 4:32 PM, Stuart Malin <<email_removed>> 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 mail archive

