Skip to content

Mat::t() Android, After give time gives out of the memory #4961

Closed
@opencv-pushbot

Description

@opencv-pushbot

Transferred from http://code.opencv.org/issues/4262

|| Karoly Somodi on 2015-04-04 14:52
|| Priority: Normal
|| Affected: branch '2.4' (2.4-dev)
|| Category: android
|| Tracker: Bug
|| Difficulty: 
|| PR: 
|| Platform: ARM / Android

Mat::t() Android, After give time gives out of the memory

<pre><code class="java">
    public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
        Mat mRgba = inputFrame.rgba().clone();
        Mat mRgbaT = mRgba.t();
        Core.flip(mRgba.t(), mRgbaT, 1);
        Imgproc.resize(mRgbaT, mRgbaT, mRgba.size());
        return mRgbaT;
    }
</code></pre>


04-04 16:39:16.723    1115-1834/com.bitflags.kioba.augmented D/FpsMeter﹕ 6.42 FPS@1280x960
04-04 16:39:16.735    1115-1115/com.bitflags.kioba.augmented D/JavaCameraView﹕ Preview Frame received. Frame size: 1843200
04-04 16:39:16.801    1115-1115/com.bitflags.kioba.augmented D/JavaCameraView﹕ Preview Frame received. Frame size: 1843200
04-04 16:39:16.841    1115-1834/com.bitflags.kioba.augmented D/CameraBridge﹕ mStretch value: 1.125
04-04 16:39:16.853    1115-1834/com.bitflags.kioba.augmented D/FpsMeter﹕ 6.42 FPS@1280x960
04-04 16:39:16.868    1115-1115/com.bitflags.kioba.augmented D/JavaCameraView﹕ Preview Frame received. Frame size: 1843200
+04-04 16:39:16.885    1115-1834/com.bitflags.kioba.augmented E/cv::error()﹕ OpenCV Error: Insufficient memory (Failed to allocate 4915204 bytes) in void* cv::OutOfMemoryError(std::size_t), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/alloc.cpp, line 52
04-04 16:39:16.886    1115-1834/com.bitflags.kioba.augmented E/org.opencv.core.Mat﹕ Mat::n_1t() caught cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/alloc.cpp:52: error: (-4) Failed to allocate 4915204 bytes in function void* cv::OutOfMemoryError(std::size_t)
04-04 16:39:16.898    1115-1834/com.bitflags.kioba.augmented E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-1798
    Process: com.bitflags.kioba.augmented, PID: 1115
    CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/alloc.cpp:52: error: (-4) Failed to allocate 4915204 bytes in function void* cv::OutOfMemoryError(std::size_t)
    ]
            at org.opencv.core.Mat.n_t(Native Method)
            at org.opencv.core.Mat.t(Mat.java:2353)
            at com.bitflags.kioba.augmented.surface.onCameraFrame(surface.java:119)
            at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:387)
            at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:328)
            at java.lang.Thread.run(Thread.java:818)
04-04 16:39:16.934    1115-1635/com.bitflags.kioba.augmented E/IMemory﹕ cannot map BpMemoryHeap (binder=0x9f60b3c0), size=11059200, fd=35 (Out of memory)
04-04 16:39:16.934    1115-1635/com.bitflags.kioba.augmented A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0xffffffff in tid 1635 (Binder_4)+
04-04 16:39:16.941    1115-1115/com.bitflags.kioba.augmented D/JavaCameraView﹕ Disconnecting from camera
04-04 16:39:16.941    1115-1115/com.bitflags.kioba.augmented D/JavaCameraView﹕ Notify thread
04-04 16:39:16.941    1115-1115/com.bitflags.kioba.augmented D/JavaCameraView﹕ Wating for thread

History

Karoly Somodi on 2015-04-04 19:00
A newer chrash i guess im not alloved to use Mat::t()  ...
it is actually *2.4.10 target* but cnat set it anywhere ...


04-04 20:57:41.406   9852-10581/com.bitflags.kioba.augmented E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-2240
    Process: com.bitflags.kioba.augmented, PID: 9852
    CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/alloc.cpp:52: error: (-4) Failed to allocate 8294404 bytes in function void* cv::OutOfMemoryError(std::size_t)
    ]
            at org.opencv.core.Mat.n_t(Native Method)
            at org.opencv.core.Mat.t(Mat.java:2353)
            at com.bitflags.kioba.augmented.surface.onCameraFrame(surface.java:120)
            at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:387)
            at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:328)
            at java.lang.Thread.run(Thread.java:818)
Steven Punte on 2015-05-18 01:19
I had success at resolving this problem by adding Mat.release() to every OpenCV Matrix object at of course locations where each object was no longer needed.  I currently operate on release 2.4.9.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions