Hi friends,
I am using kal calendar in my app. the things i have to show three different seprate calendar. When i run on instrument it puts lot of memory leaks on following codes. I am new to instruments and memory leaks. canbody suggest me what i have went wrong?
Regards, sathish
CalendarDetails.h
@interface CalendarDetails : NSObject { NSDate *date; NSString *status; NSString *duration_date; NSString *name; NSString *description;
NSString *startDate;
NSString *endDate;
NSString *reason;
NSString *note;
NSString *bid;
}
@property (nonatomic, retain, readonly) NSDate *date; @property (nonatomic, retain, readonly) NSString *status; @property (nonatomic, retain, readonly) NSString *duration_date; @property (nonatomic, retain, readonly) NSString *name; @property (nonatomic, retain, readonly) NSString *description;
@property (nonatomic, retain, readonly) NSString *startDate; @property (nonatomic, retain, readonly) NSString *endDate; @property (nonatomic, retain, readonly) NSString *reason; @property (nonatomic, retain, readonly) NSString *note; @property (nonatomic, retain, readonly) NSString *bid;
- (CalendarDetails*)holidayNamed:(NSString *)aname duration_date:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate;
- (CalendarDetails*)EventNamed:(NSString *)aname duration_date:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate des:(NSString *)ades;
(CalendarDetails*)BlockoutNamed:(NSString *)areason note:(NSString *)anote date:(NSDate *)adate startdate:(NSDate *)astartDate enddate:(NSDate *)aendDate bid:(NSString *)abid;
(id)initWithName:(NSString *)aname duration:(NSString *)duration_date status:(NSString *)astatus date:(NSDate *)adate;
- (id)initWithEventName:(NSString *)aname duration:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate des:(NSString *)ades;
(id)initWithBlockName:(NSString *)areason note:(NSString *)anote date:(NSDate *)adate startdate:(NSDate *)astartDate enddate:(NSDate *)aendDate bid:(NSString *)abid;
(NSComparisonResult)compare:(CalendarDetails *)otherHoliday;
@end
CalendarDetails.m
import "CalendarDetails.h"
@implementation CalendarDetails
@synthesize date, status, duration_date,name,description; @synthesize startDate,endDate, reason,note,bid;
(CalendarDetails*)holidayNamed:(NSString *)aname duration_date:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate { return [[[CalendarDetails alloc] initWithName:aname duration:aduration_date status:astatus date:adate] autorelease]; }
(CalendarDetails*)EventNamed:(NSString *)aname duration_date:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate des:(NSString *)ades { return [[[CalendarDetails alloc] initWithEventName:aname duration:aduration_date status:astatus date:adate des:ades] autorelease]; }
(CalendarDetails*)BlockoutNamed:(NSString *)areason note:(NSString *)anote date:(NSDate *)adate startdate:(NSDate *)astartDate enddate:(NSDate *)aendDate bid:(NSString *)abid { return [[[CalendarDetails alloc] initWithBlockName:areason note:anote date:adate startdate:astartDate enddate:aendDate bid:abid] autorelease]; }
(id)initWithName:(NSString *)aname duration:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate
{ if ((self = [super init])) { name = [aname copy]; duration_date = [aduration_date copy];status =[astatus copy]; date = [adate retain];
} return self; }
(id)initWithEventName:(NSString *)aname duration:(NSString *)aduration_date status:(NSString *)astatus date:(NSDate *)adate des:(NSString *)ades { if ((self = [super init])) { name = [aname copy]; duration_date = [aduration_date copy]; status =[astatus copy]; date = [adate retain]; description = [ades copy]; } return self; }
(id)initWithBlockName:(NSString *)areason note:(NSString *)anote date:(NSDate *)adate startdate:(NSDate *)astartDate enddate:(NSDate *)aendDate bid:(NSString *)abid{ if ((self = [super init])) { date = [adate copy]; startDate = [astartDate copy]; bid= [abid copy]; endDate = [aendDate copy]; reason =[areason copy]; note = [anote retain]; } return self; }
(NSComparisonResult)compare:(CalendarDetails *)otherHoliday { NSComparisonResult comparison = [self.date compare:otherHoliday.date]; if (comparison == NSOrderedSame) return [self.name compare:otherHoliday.name]; else return comparison; }
(void)dealloc { if (date) { [date release]; } if (status) { [status release]; } if (name) { [name release]; } if (duration_date) { [duration_date release]; } if (description) { [description release]; } if (note) { [note release]; } if (endDate) { [endDate release];
} if (reason) { [reason release];} [super dealloc]; }
@end