• 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: Alloc Mocks my World
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: refreshObject:mergeChanges: vs. stale transient (From: Frank Illenberger <email@hidden>)
 >Alloc Mocks my World (From: Philip Dow <email@hidden>)
 >Re: Alloc Mocks my World (From: j o a r <email@hidden>)

  • Prev by Date: Re: [Moderator] Re-posts (Re: How to draw correct underline ?) (SOLVED)
  • Next by Date: Method invoked on object creation
  • Previous by thread: Re: Alloc Mocks my World
  • Next by thread: WebKit plug-ins
  • Index(es):
    • Date
    • Thread