0
What happen if we send any message to an object which is released?

Open 1 Answers 26 Views Technology

What happen if we send any message to an object which is released?

1 Answer

0

Calling release on an object does not necessarily mean it’s going to be freed. It just decrements the object’s retain count. It’s not until the retain count reaches 0 the object gets freed (and even then, the object might be in an autorelease pool and still not be freed quite then).

So, you might release your object but you could still be pointing to it. And then it could get autoreleased. And then you send it a message — but maybe the object is garbage now.

by (280k points)
...