Re: Why I have a leak? I am unable to understand
Re: Why I have a leak? I am unable to understand
- Subject: Re: Why I have a leak? I am unable to understand
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Mon, 24 Aug 2009 20:28:05 -0400
On Aug 24, 2009, at 8:20 PM, Agha Khan wrote:
HI:
I know the leak is in next 2 lines
I have commented all the code except these 2 lines.
// NSTimeInterval
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |
NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |
NSSecondCalendarUnit;
NSDateComponents *dateSegments = [gregorian components:unitFlags
fromDate:[NSDate date]];
I am not releasing gregorian, because I never used retain.
Same is true with dateSegments.
You'll have to reread the memory management guide.
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html
You created gregorian using alloc + init, therefore you own it and you
do need to release it.
Hank
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden