Ios developer
Ios developer

Reputation: 105

The difference between retain count and reference count in swift

What is difference between retain count and reference count in swift ? Or they both are same ? Can any body explain it to me ?

Upvotes: 1

Views: 897

Answers (1)

matt
matt

Reputation: 534893

The retain count is an internal count maintained by an object: how many times an unbalanced retain has been sent to that object.

The reference count is an external fact: how many objects have a reference to this object.

The goal of memory management, at heart, is to keep those two numbers the same at all times.

Upvotes: 2

Related Questions