Search code examples
iosxcodememory-managementinstruments

How do i see my variables' reference count?


I have a problem with objects not being 'deallocked', does anyone know of a way to see the reference count chart in either Xcode or Instruments? I know how to do this in the leaks template in Instruments, but strangely, Leaks detects nothing. I do think there is a leak though.


Solution

  • If Instruments says there is no leak, then it surely is right (except if you managed to produce a retain cycle). You can peak at [obj retainCount], but it is strongly discouraged to do so.

    Remember that you can create "leaks" for example by putting stuff into NSMutableArrays or NSMutableDictionaries and never removing them. These kind of leaks won't show up Instruments. Same for retain cycles. So you should look for these problems.