Re: monitoring retainCount
Re: monitoring retainCount
- Subject: Re: monitoring retainCount
- From: Jonathan Jackel <email@hidden>
- Date: Wed, 26 May 2004 21:29: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..
If you want to know when an object gets destroyed, override dealloc:
- (void)dealloc
{
NSLog(@"Deallocing %@", [self description]);
[super dealloc];
}
You can also override release:
- (void)release
{
if([self retainCount] == 1) // About to go to zero, leading to dealloc
NSLog(@"Deallocing %@", [self description]);
[super release];
}
Quite vanilla.
Jonathan
_______________________________________________
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.