I used to verify that some of my variables had the expected retain count using [myVar retainCount] under the debugger, especially for var that did not have a custom dealloc.
How do you do this in ARC mode? How do you ensure that there are no memory leaks?
Note: I understand that ARC should handle this for me, but life is far from being perfect, and in real life you have objects that are sometimes allocated by third party libraries (using retain?) and never deallocated.
Image that I do this:
MyObj *myObj=[[MyObj alloc] init];
then I call
[somethingElse doSomethingWithMyObj:myObj];
and later, I do
myObj=NULL;
If my program is working fine, my expectation is that myObj is being destroyed, but it appears not to be the case...
So how can I track this, especially if somethingElse is not managed by me?
Now, about the tools: it seems extremely hard to run memory tools on my mac (with 5 Meg) without rebooting the mac and starting from scratch. This is really annoying! Instruments keep crashing even before the program has started, so is there an alterante solution?
I believe the only way is to profile your application using the Allocations instrument. You will need to click on the info descriptor (the 'i' next to Allocation in the left pane) and click on "Record Reference Counts". You can then profile your app and do a search for the specific class you're looking to inspect. From there you can find the retain count in the Extended Detail pane for each instance of the class.
You can also do this using Leaks as well (since I believe it's a variation of the Allocations instrument).