1 | initial version |
I've been running into the same issue. I managed to fix it partially though.
I pulled the latest opencv version of github and rebuild the framework myself after editing the following: In "cap_ios_abstract_camera.mm" edit the stop method to the following:
- (void)stop;
{
NSLog(@"[Camera] video stopped");
running = NO;
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
[self.captureSession stopRunning];
[self.captureSession release];
self.captureSession = nil;
self.captureVideoPreviewLayer = nil;
self.videoCaptureConnection = nil;
captureSessionLoaded = NO;
}
The only difference with the original is [self.captureSession release] which seems to "properly" clean the AVCaptureSession. Memory usage is still rising slightly on each start/stop (might even be bad memory management in the rest of my code) but not exponentially like before this fix (which resulted into a crash).
(if you're having troubles building the opencv2.framework from source, you can always have a look at a previous answer of mine.)
Hope this helps!