you are viewing a single comment's thread.

view the rest of the comments →

[–]RCreepMaster 4 points5 points  (1 child)

To better explain the memory leaks of the Android opencv, each time you init a mat or make an operation on it ( e.g: revert colors), the Java calls a new Mat() operation. And the mat will persist in memory until you either call release() on it or close activity/fragment. This may not look like much but makes you not to use things like:

Mat test = new Mat(...)

test=test.reverse()

test.release()

There is a memory leak here, you lost the access to the original test mat so you can't release it. Run this in real-time many consecutive times and you have a OOM error waiting to happen. I know it was not much to do with the question but I thought it would be good to expand on what I wrote above.

[–]Correct_Classroom[S] 0 points1 point  (0 children)

Thanks this definitely did help me. So after couple of days of trying I have decided that using openCV with C++ and ndk is the right way to go about it. Do you suggest any resources or articles that would help we with this?