I found a memory leak while profiling my application
CustomAnnotation *annotationPoint = [[CustomAnnotation alloc] initWithLatitude:store.latitude longitude:store.longitude];
annotationPoint.titleLabel = store.name;
annotationPoint.subtitleLabel = [NSString stringWithFormat:@"%dm", store.distance];
[annotationPoint setEvent:store];
[self.mapView addAnnotation:annotationPoint];
[annotationPoint release];
This is what is specified as leaking and annotationPoint.subtitleLabel = [NSString stringWithFormat:@"%dm", store.distance]; is marked with 100%
What should I do to fix this?
Are you calling [subtitleLabel release] in the dealloc function of CustomAnnotation?
This would solve the issue in this case, BUT
as I have written above :
[NSString stringWithFormat]returns an autoreleased object.This means that you have to use autoreleasepools to have correct memory management.