I have the following situation, which seems to cause my iPad application to leak memory.
I have a class with a string property...
@property(nonatomic,retain) NSString * synopsis;
I set the string property from some HTTP response, either from JSON or XML response.
At that point the retain count of the synopsis object is 1.
But I have this situation:
I save the synopsis to a local sqlite database, and then I want to release it from memory, but I have the situation where strangely, calling [synopsis release] from within my object does not decrement the retain count to 0.
(void) save
{
NSLog(@"synopsis before save retainCount=%d",[synopsis retainCount]);
[self saveToDb:synopsis withKey:@"synopsis"];
NSLog(@"synopsis after save retainCount=%d",[synopsis retainCount]);
[synopsis release];
NSLog(@"synopsis after release retainCount=%d",[synopsis retainCount]);
synopsis=nil;
}
In the console I get:
synopsis before save retainCount=1
synopsis after save retainCount=1
synopsis after release retainCount=1
How can this be possible? I get the same result running in simulator or on the device.
}