Ask Your Question

Revision history [back]

Around Jellybean version, it has been okay with just calling System.gc(). However, above versions showed me a lot of memory leak. Especially, marshmallow.

I realized that 'release()' must be called to prevent memory leak.

Ironically, if you try to release that the mat object generated automatically by onCameraFrame.

   public Mat process(CameraBridgeViewBase.CvCameraViewFrame inputFrame)
    {
        Mat rgba = inputFrame.rgba();
        Mat gray = inputFrame.gray();
        ...

Your app will be crashed on some devices. even though, there is not any other calling release() of the mat objects on java source code.

I guess. the mat objects might be deleted on native code.

Around Jellybean version, it has been okay with just calling System.gc(). However, above versions showed me a lot of memory leak. Especially, marshmallow.

I realized that 'release()' must be called to prevent memory leak.

Ironically, if you try to release that the mat object generated automatically by onCameraFrame.

   public Mat process(CameraBridgeViewBase.CvCameraViewFrame inputFrame)
    {
        Mat rgba = inputFrame.rgba();
        Mat gray = inputFrame.gray();
        ...

Your app will be crashed on some devices. even though, there is not any other calling release() of the mat objects on java source code.

I guess. the mat objects might be deleted on native code. code automatically.