• 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: monitoring retainCount
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: monitoring retainCount


  • Subject: Re: monitoring retainCount
  • From: Bob Ippolito <email@hidden>
  • Date: Wed, 26 May 2004 20:53:00 -0400

On May 26, 2004, at 7:12 PM, Stefan Fisk wrote:

i think you all are missing the point, i want to monitor the retain count in code, so that i can know when the objects i've created get destroyed, without polling each pass through the runloop etc.. what you're suggesting are debugging aids, i want to be notified atleast every time retainCount changes, preferably only when it reaches 0, and it should work while deployed on "vanilla" installs of os x..

Never ever use retainCount!

Are these arbitrary objects, or objects of a particular class? If it's a particular class that you control, then dealloc is going to get called when retainCount changes to 0, so you can override that to do something when the object should be collected. Otherwise, you probably can't do what you want to do without runtime hacks like isa swizzling (which is how key value observing works). I highly suggest that you don't attempt to do it yourself.

Your question definitely smells like premature optimization...

-bob
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: monitoring retainCount (From: "email@hidden" <email@hidden>)
 >Re: monitoring retainCount (From: Shawn Erickson <email@hidden>)
 >Re: monitoring retainCount (From: Stefan Fisk <email@hidden>)

  • Prev by Date: Re: NSFontPanel act on it's own accessory view?
  • Next by Date: Forum notify
  • Previous by thread: Re: monitoring retainCount
  • Next by thread: Re: monitoring retainCount
  • Index(es):
    • Date
    • Thread