방금 누수를 통해 내 응용 프로그램을 실행했고 다음 코드가 누수를 일으킨다는 말을 듣고 있지만 어떻게 보이지 않습니다. 이 코드가 누출 되었습니까?
은이 코드 내viewDidLoad
일부
NSMutableArray
의 할당 :
[self.currentCars removeAllObjects];
[self.expiredCars removeAllObjects];
for (Car *car in [self.dealership cars]) {
if ([car isCurrent])
[self.currentCars addObject:car];
if ([car isExpired])
[self.expiredCars addObject:car];
}
그리고 나중에 코드 I에서 :
그런 다음- (void)viewDidLoad {
[super viewDidLoad];
self.currentCars = [[NSMutableArray alloc] init];
self.expiredCars = [[NSMutableArray alloc] init];
}
내가 내 다음 내 viewWillAppear
방법의 이러한 배열을 채울 다음 배열을 출시하십시오.
- (void) viewWillDisappear:(BOOL)animated {
if (currentCars != nil) {
[currentCars release], currentCars = nil;
}
if (expiredCars != nil) {
[expiredCars release], expiredCars = nil;
}
[super viewWillDisappear:animated];
}
아이디어가 있으십니까? 감사!
누수가 보이지 않습니다. 다른 곳에 있어야합니다. 관련 코드를 추가 할 수 있습니까? – BoltClock
그 표본만을 근거로 말할 수는 없습니다. –
아마도 나는 Instruments의 잘못된 위치를보고있을 것입니다. 그러나'[self.currentCars addObject : car]; 행을 hilights하고 그 행에 100 % 지시계를 놓습니다 ... 그냥 잘못 읽은 것입니까? –