warpAffine memory leak continues in 3.1.0

asked 2016-11-28 02:53:25 -0500

ed gravatar image

updated 2016-11-28 04:42:24 -0500

berak gravatar image

I found the issue "warpAffine memory leak" in the buglist to be handled last year. Is this finished or must it still be "merged" to the project? I'm using OpenCV 3.1.0 with Linux and MS-Windows and the problem still exists. This simple program (I'm sorry, but the input destroys format of the source and deletes some signs) causes a memory leak (a more complex program ran out of memory and caused me to find this). Is this a known issue and will be handled?

include opencv2/core/mat.hpp
include opencv2/imgproc.hpp

void Rotate(cv::Mat& Pic, double Angle_Degree)
{   // Rotate image around center
    cv::warpAffine(
        Pic,
        Pic,
        cv::getRotationMatrix2D(cv::Point_<float>(Pic.cols/2, Pic.rows/2), Angle_Degree, 1),
        cv::Size(Pic.cols, Pic.rows),
         cv::INTER_LINEAR
        );
}

int main()
{
    cv::Mat Pic(1000, 1000, CV_8UC(3), cv::Scalar::all(0.0));
    Rotate(Pic, 45.0);
    return 0;
}

Valgrind now shows:

==6252== 608 bytes in 1 blocks are definitely lost in loss record 21 of 29
==6252==    at 0x4A057BB: calloc (vg_replace_malloc.c:593)
==6252==    by 0x3BF5811A82: _dl_allocate_tls (dl-tls.c:318)
==6252==    by 0x3BF64072CC: pthread_create@@GLIBC_2.2.5 (allocatestack.c:576)
==6252==    by 0x6F31DA8: cv::ThreadManager::initPool() (in /usr/local/lib/libopencv_core.so.3.1.0)
==6252==    by 0x6F31EE2: cv::ThreadManager::run(cv::Range const&, cv::ParallelLoopBody const&, double) (in /usr/local/lib/libopencv_core.so.3.1.0)
==6252==    by 0x56B3AAE: cv::warpAffine(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&) (in /usr/local/lib/libopencv_imgproc.so.3.1.0)
==6252==    by 0x411353: Rotate(cv::Mat&, double) (main.cpp:12)
==6252==    by 0x411458: main (main.cpp:18)
==6252== 
==6252== 4,256 bytes in 7 blocks are possibly lost in loss record 29 of 29
==6252==    at 0x4A057BB: calloc (vg_replace_malloc.c:593)
==6252==    by 0x3BF5811A82: _dl_allocate_tls (dl-tls.c:318)
==6252==    by 0x3BF64072CC: pthread_create@@GLIBC_2.2.5 (allocatestack.c:576)
==6252==    by 0x6F31DA8: cv::ThreadManager::initPool() (in /usr/local/lib/libopencv_core.so.3.1.0)
==6252==    by 0x6F31EE2: cv::ThreadManager::run(cv::Range const&, cv::ParallelLoopBody const&, double) (in /usr/local/lib/libopencv_core.so.3.1.0)
==6252==    by 0x56B3AAE: cv::warpAffine(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&) (in /usr/local/lib/libopencv_imgproc.so.3.1.0)
==6252==    by 0x411353: Rotate(cv::Mat&, double) (main.cpp:12)
==6252==    by 0x411458: main (main.cpp:18)
edit retag flag offensive close merge delete

Comments

About issue is it this one? If yes it is solved in 2.4.13. I cannot find issue for 3.1. May be you should check and if you don't find this issue write a new issue for 3.1

LBerger gravatar imageLBerger ( 2016-11-28 04:40:10 -0500 )edit