Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-21-2010, 07:55 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 92
Default Why is this date calc reporting leak ?

Code:
- (NSDate *) addDaysToDate:(NSDate*)startDate :(int)daysToAdd{
	
	// set up date components
	NSDateComponents *components = [[NSDateComponents alloc] init];
	[components setDay:daysToAdd];
	
	// create a calendar
	NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
	
	NSDate *newDate = [gregorian dateByAddingComponents:components toDate:startDate options:0];
	return newDate;
	
	[gregorian release];
	[components release];
	[newDate release];
}
Called to populate an NSDate property of my custom search criteria class. The addDaysToDate method lives the the appDelegate, just for ease of calling

Code:
@property (nonatomic, retain) NSDate *startDate;
@property (nonatomic, retain) NSDate *endDate;
Code:
	self.startDate = [NSDate date]; // Todays date
	self.endDate   = [UIAppDelegate addDaysToDate:self.startDate :30];
When addDaysToDate is called with instruments in leak mode it reports
icu::GregorianCalendar
icu::NumberFormat
icu::SimpleTimeZone
NSDateComponents
NSCFCalendar
funkyspider is offline   Reply With Quote
Old 03-21-2010, 08:28 AM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

'return' is the end of a method. Your releases are not happening.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 03-21-2010, 08:53 AM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 92
Default

Quote:
Originally Posted by BrianSlick View Post
'return' is the end of a method. Your releases are not happening.
Doh !
Thanks - I knew I should have stayed with C#
funkyspider is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 316
19 members and 297 guests
@sandris, ADY, dacapo, Dani77, djohnson, dre, HDshot, HemiMG, JasonR, MarkC, mer10, nibeck, prchn4christ, ryandb2, spiderguy84, timle8n1, tomtom100, vogueestylee
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:05 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0