Re: Alloc Mocks my World
Re: Alloc Mocks my World
- Subject: Re: Alloc Mocks my World
- From: Philip Dow <email@hidden>
- Date: Fri, 26 Aug 2005 10:35:53 +0200
Wow, nifty tool ObjectAlloc.
According to ObjectAlloc's event inspector, the JRLREntryCell object
is being retained and not released as the nib loads by an instance of
NSObjectController. I do use bindings in this nib file, so the
possibility is not unlikely.
However, I'm still lost. If the NSObjectController retains my object,
which is the nib's file owner and the source of the object
controller's content, and the object controller does not release my
object, how will my object ever be deallocated?
-Phil
http://phildow.net
On 25.08.2005, at 10:59, j o a r wrote:
On 25 aug 2005, at 10.43, Philip Dow wrote:
The very next line of code reads: int retCount = [newCell
retainCount]; And what is the retain count? 3. Three! Not one. Not
even two. Three. How in the world is my allocation and
initialization producing a retain count of three?
<snip>
Nothing I've read about object allocation and nib ownership
suggests that this code would produce an object with a retain
count of three. If declaring the object owner of the nib increased
the retain count, then maybe I would understand two. But in all
the examples of seen, no one seems to worry that something like
this is happening. The "Loading Resources" documentation doesn't
mention this either. Does anyone know how the retain count hits 3
then?
This pops up every so often. What you forget is most likely the
effect of autorelease. The interesting thing to monitor is the
*effective* retain count, not the absolute retain count.
Don't spend time trying to track the absolute retain count.
Concentrate on balancing your own retain / release events. If you
suspect leaks, or other memory management problems, use the
appropriate tools: NSZombie, ObjectAlloc, et.c.
j o a r
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden