I have a singleton object that is approximately equivalent to something like @"" which I want to keep around. So I am looking at this, to save me having to check the object in other code:
I have observed that you do not seem to need -retain to prevent an object from being deallocated, just bypass the [super dealloc]. Is this behavior consistent? In my experiment, when I included -retain in the -dealloc method, it seemed to increment the retain count (the object required 2 releases to go away). Not that this would matter in this case, I was just curious if anyone knew whether I can count on not needing the -retain?
Code:
- (void)dealloc {
if ( self != theSingleltonObject ) {
// release my ivars
[super dealloc];
}
}