opencv_contrib
opencv_contrib copied to clipboard
CvKnearest::find_nearest memory leak
Transferred from http://code.opencv.org/issues/3263
|| Thierry Moreira on 2013-09-12 15:46
|| Priority: Normal
|| Affected: 2.4.6 (latest release)
|| Category: ml
|| Tracker: Bug
|| Difficulty:
|| PR:
|| Platform: x64 / Linux
CvKnearest::find_nearest memory leak
There is a huge memory leak in the CvKnearest::find_nearest method.
Valgrind report:
<pre>
==4838== Invalid read of size 4
==4838== at 0x4026A8: main (in /home/thierry/classificador/clas)
==4838== Address 0x6af1c58 is not stack'd, malloc'd or (recently) free'd
==4838==
--4838-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting
--4838-- si_code=80; Faulting address: 0x0; sp: 0x402bdadf0
valgrind: the 'impossible' happened:
Killed by fatal signal
==4838== at 0x38058CBE: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==4838== by 0x3802144C: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==4838== by 0x38021A80: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==4838== by 0x38021C6A: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==4838== by 0x380902A7: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==4838== by 0x3809F7D5: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
sched status:
running_tid=1
Thread 1: status = VgTs_Runnable
==4838== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4838== by 0x4F44320: cv::fastMalloc(unsigned long) (in /usr/local/lib/libopencv_core.so.2.4.6)
==4838== by 0x4F72A1E: cvCreateMatHeader (in /usr/local/lib/libopencv_core.so.2.4.6)
==4838== by 0x4F76E75: cvCreateMat (in /usr/local/lib/libopencv_core.so.2.4.6)
==4838== by 0x52A0915: cvPreprocessIndexArray(CvMat const*, int, bool) (in /usr/local/lib/libopencv_ml.so.2.4.6)
==4838== by 0x52A2256: cvPrepareTrainData(char const*, CvMat const*, int, CvMat const*, int, CvMat const*, CvMat const*, bool, float const***, int*, int*, int*, CvMat**, CvMat**, CvMat**, CvMat**) (in /usr/local/lib/libopencv_ml.so.2.4.6)
==4838== by 0x52846C0: CvKNearest::train(CvMat const*, CvMat const*, CvMat const*, bool, int, bool) (in /usr/local/lib/libopencv_ml.so.2.4.6)
==4838== by 0x5284C70: CvKNearest::train(cv::Mat const&, cv::Mat const&, cv::Mat const&, bool, int, bool) (in /usr/local/lib/libopencv_ml.so.2.4.6)
==4838== by 0x528645C: CvKNearest::CvKNearest(cv::Mat const&, cv::Mat const&, cv::Mat const&, bool, int) (in /usr/local/lib/libopencv_ml.so.2.4.6)
==4838== by 0x402410: main (in /home/thierry/classificador/clas)
</pre>
History
Daniil Osokin on 2013-09-17 18:27
Hi, Thierry! Could you please localize the place of memory leak? Please, provide a test sample to observe this. May be you can make a pull request with bugfix? Contributions are highly appreciated.
- Target version set to 2.4.8
- Assignee set to Thierry Moreira
- Category set to ml
Anna Kogan on 2013-10-03 08:02
- Description changed from There is a huge memory leak in the
CvKnearest::find_nearest method. Valgrind ... to There is a huge
memory leak in the CvKnearest::find_nearest method. Valgrind ...
More
- Status changed from New to Open
Alexander Smorkalov on 2013-12-30 10:38
- Target version changed from 2.4.8 to 2.4.9
Alexander Smorkalov on 2014-04-30 19:05
- Target version changed from 2.4.9 to 2.4.10