Valgrind report possible lost on "cv::initUndistortRectifyMap"

asked 2020-02-05 10:11:57 -0600

Hi, OpenCV Team

I used valgrind to check memory leak, and it reports the following warning. This problem appears on [Linux 16.04 / OpenCV 4.2 / gcc 5.4], but it does not appear on old version of OpenCV [Linux 16.04 / OpenCV 2.4.13 / gcc 5.4]. I am just wonder whether it is due to the wrong way of using it, or something else.

My Code:

Mat distort = (Mat_<double>(5, 1) << -0.378924f, 0.145035f, -0.000970854f, 6.20728e-005f, -0.0133954f);
Mat camera = (Mat_<double>(3, 3) << 210.783f, 0., 157.262f , 0., 204.817f, 122.083f, 0., 0., 1.);
Mat map1, map2, None, new_matrix, rectify_table;
new_matrix = getOptimalNewCameraMatrix(camera, distort, Size(320, 240), 1, Size(320, 240), 0);
initUndistortRectifyMap(camera, distort, Mat(), new_matrix, Size(320, 240), CV_32FC1, map1, map2);
cv::remap(rectify_table, rectify_table, map1, map2, INTER_NEAREST, BORDER_CONSTANT, Scalar(-1));

Information from Valgrind:

==15826== 2,240 bytes in 7 blocks are possibly lost in loss record 38 of 40
==15826==    at 0x4C2FFAC: calloc (vg_replace_malloc.c:762)
==15826==    by 0x40138B4: allocate_dtv (dl-tls.c:322)
==15826==    by 0x40138B4: _dl_allocate_tls (dl-tls.c:539)
==15826==    by 0x535026E: allocate_stack (allocatestack.c:588)
==15826==    by 0x535026E: pthread_create@@GLIBC_2.2.5 (pthread_create.c:539)
==15826==    by 0x821E04: cv::WorkerThread::WorkerThread(cv::ThreadPool&, unsigned int) (in /mnt/d/Documents/Workspace/DM/dmhc/dmhc_app/dmhc_app-master/build/pc/dmhc_app)
==15826==    by 0x823432: cv::ThreadPool::reconfigure_(unsigned int) (in /mnt/d/Documents/Workspace/DM/dmhc/dmhc_app/dmhc_app-master/build/pc/dmhc_app)
==15826==    by 0x823F62: cv::ThreadPool::run(cv::Range const&, cv::ParallelLoopBody const&, double) (in /mnt/d/Documents/Workspace/DM/dmhc/dmhc_app/dmhc_app-master/build/pc/dmhc_app)
==15826==    by 0x81FE6F: cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double) (in /mnt/d/Documents/Workspace/DM/dmhc/dmhc_app/dmhc_app-master/build/pc/dmhc_app)
==15826==    by 0x656EE4: cv::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, int, cv::_OutputArray const&, cv::_OutputArray const&) (in /mnt/d/Documents/Workspace/DM/dmhc/dmhc_app/dmhc_app-master/build/pc/dmhc_app)
==15826==    by 0x4F3146: dmhc::HcPreprocess::precompute(cv::Mat const&, cv::Mat const&) (hc_preprocess.cpp:76)

I am looking forward you to reply

Thank you

By David

edit retag flag offensive close merge delete