I have a memory leak at NSDate. Please review the code below.
-(void)myMethods:(NSDate *)currentTime{
[NSThread detachNewThreadSelector:@selector(mySecondMethods) toTarget:self withObject:nil];
}
-(void) mySecondMethods{
NSDate * currentDateTime = [NSDate date];------->memory leak here
for (Event * event in array) {
if(![event checkOccur:currentDateTime]){
return;
} else {
[NSThread detachNewThreadSelector:@selector(start) toTarget:event withObject:nil];
}
}
}
If you are calling any method in a thread you have to use Autorelease Pool.