2010-08-09 6 views
3

iPhone SDK의 새 AVFoundation 클래스에서 이상한 동작이 발생합니다.AVCaptureStillImageOutput outputSettings memory leak

나는 사진을 찍기 위해 AVCaptureStillImageOutput을 가지고 있으며, 나는 그것의 outputSettings를 좋아한다. 이 코드는 다음과

AVCaptureStillImageOutput *stillImageOutput = [[[AVCaptureStillImageOutput alloc] init] autorelease]; 
[stillImageOutput setOutputSettings:[NSDictionary dictionaryWithObject:AVVideoCodecJPEG forKey:AVVideoCodecKey]]; 
[self setStillImageOutput:stillImageOutput]; 

I의 setOutputSettings 라인 누설 결함의 100 %, 누수 누설 우연히

(stillImageOutput 속성 "유지"로 정의된다). 내가 첨부 된 코드의 메모리 관리 지침에 국한한다고 믿지만 아직도 유출되었다.

내 솔루션은

[self setStillImageOutput:nil]; 

참으로 중지 누수 전에의 dealloc에 ​​

[self.stillImageOutput setOutputSettings:nil]; 

이었다, 그러나 그것은 이상한 보인다. stillImageOutput의 릴리스는 outputSettings 속성도 릴리스해야합니까?

어쨌든 누군가 다른 사람이이 문제에 부딪치게되면 내 솔루션을 공유해야한다고 생각합니다.

건배!
Oded.

+0

추가 정보 : http://stackoverflow.com/questions/1458178/iphone-dealloc-release-vs-nil/1458202#1458202 – iwasrobbed

답변

0

그래, stillImageOutput 을 릴리스하면도 outputSettings 속성을 릴리스해야합니다. Apple 버그 (사용 사례는 매우 간단 함) 또는 선을 제거하고 클래스가 아닌 다른 것이 stillImageOutput 객체 (outputSettings를 보유하고 있는지)에 매달려 있는지 확인하십시오.