opencv / opencv_for_ios_book_samples

"OpenCV for iOS" book samples

Home Page:http://bit.ly/OpenCV_for_iOS_book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chapter13_SavingVideo how to release memory after saving?

LNAdmin opened this issue · comments

Hello, I have a question regarding the code on chapter 13. It works well the only issue I have is that memory usage keeps growing every time I record a new video…. How do you release memory, so the application does not crash… Thank you.

Interesting: by simply commenting out the dealloc method, I get some memory freed up (but not good enough). Perhaps dealloc prevents Automatic Reference Counting, which is engaged by default in Xcode (after 5.0, I believe)

Edit: Also, there are problems with the Stop Capture button.

  1. You can press it at any time, and will get the "Saved to gallery" message.

  2. It will save whatever the last video was again. This happens even if you close the app and reopen it. (a clue!)

  3. If you take a video and press Stop Capture twice, the app crashes.

Second Edit:

The memory problem seems to be in all recipes that capture an image. We just didn't notice it until it came to video. This could be helpful, since we can backtrack to more simple recipes and solve the problem from there.

(Luckily the Stop Capture button was not disabled by default or else I wouldn't have noticed it could be used to save multiple copies of the last taken video)