How to check the retain count while debugging

mrd3650 picture mrd3650 · Sep 10, 2011 · Viewed 12.8k times · Source

Does anybody know how can I check the retain count of an object while in debug mode? I have tried to add an expression [objInstance retainCount] but it did not work. I have also tried the print object PO [objInstance retainCount] in the console but again it did not work.

Answer

Pranav Bhargava picture Pranav Bhargava · Sep 10, 2011

I am guessing you are talking about getting the retainCount in GDB?

You can use the retainCount method.

This is how I get in my Code.

(gdb) p (int)[product retainCount]
$2 = 4

Hope this is what you are looking for.