我在iPhone SDK的新AVFoundation类中遇到了wierd行为。
我有一个AVCaptureStillImageOutput用于拍照,我正在根据自己的喜好设置它的输出设置。代码如下:
AVCaptureStillImageOutput *stillImageOutput = [[[AVCaptureStillImageOutput alloc] init] autorelease];
[stillImageOutput setOutputSettings:[NSDictionary dictionaryWithObject:AVVideoCodecJPEG forKey:AVVideoCodecKey]];
[self setStillImageOutput:stillImageOutput];
(stillImageOutput属性定义为“retain”)
我无意中发现了一个漏洞,100%的漏洞都在
行。我相信,我只限于内存管理准则中所附的代码,它仍然在泄漏。
[self.stillImageOutput setOutputSettings:nil];
就在那之前
[self setStillImageOutput:nil];
泄漏确实停止了,但看起来很奇怪。难道不应该释放
静态图像输出
释放它
财产也是?
不管怎样,如果有人遇到这种情况,我想我应该分享我的解决方案。
干杯!
奥德。