Skip to content

Memory leaks in rv #5

@sotlampr

Description

@sotlampr

Hi, while debugging another issue I ran rv with address sanitizer and get consistently these leaks:

=================================================================
==2917355==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 17472 byte(s) in 312 object(s) allocated from:
    #0 0x7e5995afe548 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x5fde18538418 in getroottopology(cv::Mat&, cv::Mat, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&, std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >&, bool, int) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/roottopology.cpp:888
    #2 0x5fde184e13ed in feature_extractor(_feature_config*) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/feature_extraction.cpp:1186
    #3 0x5fde1844054f in analyzeImage(_feature_config*) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/rv.cpp:927
    #4 0x5fde18436faf in main /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/rv.cpp:1210
    #5 0x7e599322a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #6 0x7e599322a28a in __libc_start_main_impl ../csu/libc-start.c:360
    #7 0x5fde18438784 in _start (/home/sot/.local/bin/rv+0x26784) (BuildId: 682825011aa4cfcb5d2d6fe299c818fd414728bf)

Indirect leak of 249600 byte(s) in 312 object(s) allocated from:
    #0 0x7e5995afe548 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x5fde184f2e1f in std::__new_allocator<cv::Point_<int> >::allocate(unsigned long, void const*) /usr/include/c++/13/bits/new_allocator.h:151
    #2 0x5fde184f2e1f in std::allocator_traits<std::allocator<cv::Point_<int> > >::allocate(std::allocator<cv::Point_<int> >&, unsigned long) /usr/include/c++/13/bits/alloc_traits.h:482
    #3 0x5fde184f2e1f in std::_Vector_base<cv::Point_<int>, std::allocator<cv::Point_<int> > >::_M_allocate(unsigned long) /usr/include/c++/13/bits/stl_vector.h:381
    #4 0x5fde184f2e1f in std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >::reserve(unsigned long) /usr/include/c++/13/bits/vector.tcc:79
    #5 0x5fde185386c0 in rootsegment::rootsegment(cv::Point_<int>, int) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/roottopology.cpp:69
    #6 0x5fde185386c0 in getroottopology(cv::Mat&, cv::Mat, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&, std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&, std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >&, bool, int) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/roottopology.cpp:888
    #7 0x5fde184e13ed in feature_extractor(_feature_config*) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/feature_extraction.cpp:1186
    #8 0x5fde1844054f in analyzeImage(_feature_config*) /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/rv.cpp:927
    #9 0x5fde18436faf in main /home/sot/src/RhizoVisionExplorer/RhizoVisionExplorer/rv.cpp:1210
    #10 0x7e599322a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #11 0x7e599322a28a in __libc_start_main_impl ../csu/libc-start.c:360
    #12 0x5fde18438784 in _start (/home/sot/.local/bin/rv+0x26784) (BuildId: 682825011aa4cfcb5d2d6fe299c818fd414728bf)

SUMMARY: AddressSanitizer: 267072 byte(s) leaked in 624 allocation(s).

I thought you might want to know!

S.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions