0
我發現內存泄漏,同時剖析我的應用程序內存泄漏,同時創造註解點
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];
這是被指定爲泄漏和annotationPoint.subtitleLabel = [NSString stringWithFormat:@"%dm", store.distance];
標有100%
我應該怎麼做才能解決這個問題?
您是否在自定義註釋的dealloc函數中調用[subtitleLabel release]?如何定義屬性?分配?保留? – guitarflow 2012-02-09 23:36:46
'[NSString stringWithFormat]'由NSString自動釋放。如果你沒有安裝autoreleasepool,NSString就會泄漏。 – guitarflow 2012-02-09 23:44:18
@guitarflow第一個想法是正確的。我忘了在自定義註釋中發佈。謝謝。發佈一個解決方案,我會標記是正確的。乾杯 – Mikael 2012-02-09 23:49:50