Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Printing Retain Count To Console

Printing Retain Count To Console
Thread Tools
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
May 31, 2003, 01:31 PM
 
Well, I'm beating myself up trying to catch a bug in my app and figured that it would help if i could print out an object's retain count to the console and see what's going on.

Ideally, something like:


[SomeObject getRetainCountAsString];


Thanks!


     
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
May 31, 2003, 01:58 PM
 
printf( "someObject's retainCount: %d\n", [someObject retainCount] );
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
DaGuy  (op)
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
May 31, 2003, 03:25 PM
 
Cool! It doesn't get any better than that.

Thanks!

     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
May 31, 2003, 03:58 PM
 
Originally posted by DaGuy:
Cool! It doesn't get any better than that.
Yeah it does! You can do it from the debugger without having to recompile your code. Set a breakpoint wherever you want to check a retain count and when you hit it, type into the debugger console:
p (int)[someObject retainCount]
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
DaGuy  (op)
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
May 31, 2003, 11:28 PM
 
This time I'm shutting up. Thanks guys, really appreciate it.

     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:37 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2