I experience strange behavior in the new AVFoundation classes in the iPhone SDK.
I have an AVCaptureStillImageOutput for shooting, and I adjust my output settings to my liking. Code follows:
AVCaptureStillImageOutput *stillImageOutput = [[[AVCaptureStillImageOutput alloc] init] autorelease];
[stillImageOutput setOutputSettings:[NSDictionary dictionaryWithObject:AVVideoCodecJPEG forKey:AVVideoCodecKey]];
[self setStillImageOutput:stillImageOutput];
(the stillImageOutput property is defined as "save")
I came across a leak in a leak, with a 100% leak failure on the setOutputSettings line. I believe that I am limited to the memory management guidelines in the attached code, but still it is leaking.
My solution was to
[self.stillImageOutput setOutputSettings:nil]
in dealloc, just before
[self setStillImageOutput:nil]
The leak really stopped, but it looks weird. Should releasing stillImageOutput also output the outputSettings property?
In any case, if someone else comes across this, I thought that I should share my decision.
!
.