Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when failing to acquire a camera #6

Open
kbingham opened this issue Jul 25, 2022 · 0 comments
Open

Memory leak when failing to acquire a camera #6

kbingham opened this issue Jul 25, 2022 · 0 comments

Comments

@kbingham
Copy link
Owner

Trivial, and not likely to be permantantly losing memory - but my build tests report a memory leak using LeakSanitizer if I try to run simple-cam while the (first/only?) camera is in use elsewhere:


==3944173==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f5fa39bf1c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x7f5f9fe7711e in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > >::allocate(unsigned long, void const*) (/home/kbingham/iob/libcamera/ci/integrator/builds/unit-tests/src/libcamera/libcamera.so.0+0x284f11e)
    #2 0x7f5f9fe7674f in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > >&, unsigned long) (/home/kbingham/iob/libcamera/ci/integrator/builds/unit-tests/src/libcamera/libcamera.so.0+0x284e74f)
    #3 0x7f5f9fe74cd7 in std::_Rb_tree<libcamera::Stream*, std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > >, std::_Select1st<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > >, std::less<libcamera::Stream*>, std::allocator<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > >::_M_get_node() (/home/kbingham/iob/libcamera/ci/integrator/builds/unit-tests/src/libcamera/libcamera.so.0+0x284ccd7)
    #4 0x7f5f9fe7147c in std::_Rb_tree_node<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > >* std::_Rb_tree<libcamera::Stream*, std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > >, std::_Select1st<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > >, std::less<libcamera::Stream*>, std::allocator<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<libcamera::Stream* const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<libcamera::Stream* const&>&&, std::tuple<>&&) /usr/include/c++/11/bits/stl_tree.h:611
    #5 0x7f5f9fe6edf2 in std::_Rb_tree_iterator<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > std::_Rb_tree<libcamera::Stream*, std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > >, std::_Select1st<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > >, std::less<libcamera::Stream*>, std::allocator<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<libcamera::Stream* const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > >, std::piecewise_construct_t const&, std::tuple<libcamera::Stream* const&>&&, std::tuple<>&&) /usr/include/c++/11/bits/stl_tree.h:2431
    #6 0x7f5f9fe6c46e in std::map<libcamera::Stream*, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > >, std::less<libcamera::Stream*>, std::allocator<std::pair<libcamera::Stream* const, std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > > > >::operator[](libcamera::Stream* const&) /usr/include/c++/11/bits/stl_map.h:501
    #7 0x7f5f9fe69b3d in libcamera::FrameBufferAllocator::allocate(libcamera::Stream*) ../../src/libcamera/src/libcamera/framebuffer_allocator.cpp:96
    #8 0x55f47f3e74b4 in main ../../src/simple-cam/simple-cam.cpp:341
    #9 0x7f5f9c563d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f5fa39bf1c7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55f47f3e70da in main ../../src/simple-cam/simple-cam.cpp:338
    #2 0x7f5f9c563d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 128 byte(s) leaked in 2 allocation(s).
/home/kbingham/iob/libcamera/ci/integrator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant