4
이 3 가지 경우에 메모리 누출이 발생합니까?지역 변수가 ARC와 함께 메모리 누수를 유발할 수 있습니까?
-
을 __strong
- (void)function {
__strong NSString *string = [[NSString alloc] initWithString: @"Hello World"];
}
없음 을 __strong 및 전무
- (void)function {
NSString *string = [[NSString alloc] initWithString: @"Hello World"];
}
없이 세트 무기 호에 정해진하지만 사용 을 __strong
없음 하지만
전무 설정 내가 어떤 키워드를 설정하지 않으면자동 참조 (ARC)를 계산으로- (void)function {
NSString *string = [[NSString alloc] initWithString: @"Hello World"];
string = nil;
}
, 나는 변수가을 __strong 가정?
아니요, 아니요, 아니요, 예 :) – dasblinkenlight
'NSString * string = @ "Hello World";'가 훨씬 짧습니다. 메소드 내에서 다른 조치는 필요하지 않습니다. –