• 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: 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.


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: How far with accessors?
  • Next by Date: Re: NSFontPanel act on it's own accessory view?
  • Previous by thread: Re: monitoring retainCount
  • Next by thread: Re: monitoring retainCount
  • Index(es):
    • Date
    • Thread