开发者

Date formatter memory leak

开发者 https://www.devze.com 2023-02-05 11:30 出处:网络
Hey, I\'ve been wokring through my app and removing the memory leaks but the below one has me beaten, any help would be much appreciated.

Hey, I've been wokring through my app and removing the memory leaks but the below one has me beaten, any help would be much appreciated.

NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter setDateFormat:@"dd/MM/yyyy"];

claim.date = [dateFormatter dateFromString:[data objectForKey:key]];
[dateFormatter release];

The date property is defined as:

@property (nonatomic, retain) NSDate *date

Thanks

Edit:

Forgot to mention where the memory leak occurred, its on line claim.date = [dateFo开发者_开发技巧rmatter dateFromString:[data objectForKey:key]];


I suspect one or both of the following:

  1. The owner of claim never released it
  2. The implementation of claim does not send the release message to date in its dealloc and/or does not self.date = nil in the viewDidUnload.
0

精彩评论

暂无评论...
验证码 换一张
取 消