Reputation: 8425
In Objective-C all objects can be released from memory using release function ?
Upvotes: 0
Views: 814
Reputation: 95335
Not every object needs to be released. You should revise the memory management guidelines, this a comprehensive guide about memory management.
The gist of it is: if you obtained an object from a method with the word alloc
, new
or copy
in its name, then you need to release
it. You also need to balance each retain
with a release
or autorelease
.
release
only reduces an objects retain count, it does not necessarily deallocate it from memory. It is only deallocated when its retain count reaches 0.
Upvotes: 4
Reputation: 8225
Objects are not necessarily cleared from memory when you call release. Also, it might be necessary to call special functions for Core Foundation objects (such as CGColorRef). In general, you have to call one release or autorelease for every alloc, retain or copy call you make on an object.
For more details, see Apple's memory management guide.
Upvotes: 0
Reputation: 110
Yes,You should release all objects,if you alloc/retain/copy the objects....
Upvotes: 0