Yue Zhang
Yue Zhang

Reputation: 201

[XXX retainCount]==0 really represent memory released?

all when i use [nsmutablearray removeAllObjects] i got : [nsmutableArray retainCount]==1;

then,i use [nsmutableArray relese]; i got [nsmutableArray retainCount]==1;

so ,i think ,is [XXX retainCount]==0 really represent memory released???

Upvotes: 0

Views: 190

Answers (2)

user123444555621
user123444555621

Reputation: 152956

From the official docs:

Important: Typically there should be no reason to explicitly ask an object what its retain count is (see retainCount). The result is often misleading, as you may be unaware of what framework objects have retained an object in which you are interested. In debugging memory management issues, you should be concerned only with ensuring that your code adheres to the ownership rules.

Upvotes: 5

bbum
bbum

Reputation: 162712

retainCount can never return 0.

Upvotes: 3

Related Questions