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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to