Re: monitoring retainCount
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.