Posts Tagged ‘memory management’
Avoid Retain Cycles In Objective-C
Found an excellent set of rules from Matt Gallagher on how to avoid retain cycles in Objective-C.
Uh-Oh A Class Is Still Retained Somewhere…
A problem that can occur in Objective-C is that when you start sharing objects between classes and increasing the retain count you can end up with a situation where one class inherits from another, and then when you want to release the object does not get released from memory because it is being retained by a class lower down the class hierarchy.
One Basic Rule
Now if this all sounds confusing, Matt explains everything well in his article, and has created a set of 5 rules. Ultimately it comes down to one basic rule:
Objective-C Dev Programming Tutorial On Memory Management
Something I’ve found with talking to programmers new to Objective-C is that most often the most confusing concept is memory management.
The reason for this is because in Objective-C memory is managed in a different manner from the mainstream languages typically taught in school (C/C++/Java), and introduces new concepts such as the retain count, and auto release pools.