 |
 |
Printing Retain Count To Console
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
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
|
|
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
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
Cool! It doesn't get any better than that.
Thanks!

|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
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.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
This time I'm shutting up. Thanks guys, really appreciate it.

|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |