Menu

Memory Junk

When developing on the iPhone, I find that memory management is a real pain. The thing that I found out today that I think is craziest (at least so far) is the fact that Apple includes a special method that is called when the device is low on RAM.

I found out today that this is slightly flawed because when debugging a program that had received the EXC_BAD_ACCESS signal, I found that this method was being called more than once! This is a big problem because if you are deallocating a whole bunch of stuff in that method and it is being called multiple times, your program will crash because it is trying to deallocate something that is already deallocated! It took me hours to figure out what was going wrong and why it was crashing.