Reference count is still 1 after [obj release], when it should be deallocated

后端 未结 2 1501
一整个雨季
一整个雨季 2021-01-15 01:23

When I create an object and check its retain count, I get 1 as expected. When I release the object and then check the retain count again, it is still 1. Shouldn\'t the objec

2条回答
  •  -上瘾入骨i
    2021-01-15 01:54

    Do not depend on retainCount. And do not care about this. Lots of things may happen under the hood. You only need to ensure that you have released all the things that you owned. If you are trying to be sure that you are not leaking any memory, then use Instrument, not retainCount in NSLog.

提交回复
热议问题