Below is a simple function that accepts a date as a string, converts it to a proper date format and returns it as a NSDate
-(NSDate*) dateLabelSet:(NSString*)strDate
{
NSDate *activeDate;
NSDateFormatter *format;
format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
activeDate = [format dateFromString:strDate];
[format release];
return activeDate;
}
When I run this through leaks in instruments, it is saying that format is leaky. The function seems relatively straight forward… Declares format locally, utilizes it, and releases it before returning the date.
Anyone have any suggestions?
Much appreciated!
I think this is an internal memory leak in NSDateFormatter class, like in [NSString stringByAppending…] methods in NSString class. Nothing we can do about it.