In This Chapter
• Why there is no garbage collector
• Reference counting
• The golden rules of memory management
Imagine your app crashes, providing very few details in the console beyond the cryptic string EXC_BAD_ACCESS. Now, multiply the aggravation you feel 100-fold as this EXC_BAD_ACCESS message shows up repeatedly while developing your app. You slowly move code around and hack until the errors go away, but you’re left with code you completely don’t understand anymore. How did this happen?
You have just roughly approximated the experience of almost every Cocoa developer to come before you. EXC_BAD_ACCESS is a sign of problems with memory management in your app. Memory management is by far ...