Hi,
Im pretty new to objective-c programming and releasing of objects is my greatest headache. I'm always doubting on what need to be released, and my times I've end up releasing the wrong variable and getting a BAD EXEC crash. I've read apple's guide on memory management, but I cant always go from their examples to my code.
One of these situations is my singletons (Im a big Singleton guy).
I have one define as this:
static Configuration* _instance;
+(Configuration*)getInstance{
if (_instance == NULL){
_instance = [Configuration alloc];
[_instance initConfig];
}
return _instance;
}
In my code I use it like this:
//Store configuration
Configuration* conf = [Configuration getInstance];
conf.userName = self.userName.text;
conf.cellPhone = self.phoneNumber.text;
Do I need to release the "conf" variable?
When should I release the _instance?
Since Im running this code on iPhone, what happens with the vars I don't release? will they affect the iPhone performance?
Thanks in advance! Gonso