Ask Your Question

Revision history [back]

Memory deallocation in android.

Hello. I am a newbie at OpenCV Framework. I made an android app with OpenCV. Unfortunately, My app was crashed when i used openCV.

Main reason of crash was 'Out of Memory'.

So i called 'System.gc()' on every onCameraFrame calling. Result in, i could prevent memory usage increasing.

But, i am confused. Whether i should call release() after using mat object or not. Yes, i agree. that's way might be better. but, sample source codes do not do it.

in the sample code, mat objects is released when onCameraViewStopped() is called. but also, the mat objects is changed on every onCameraFrame() without release() calling.

so, i really wonder. should i call release function in android?