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

Remaining memory leaks #2289

Closed
neheb opened this issue Dec 2, 2021 · 6 comments
Closed

Remaining memory leaks #2289

neheb opened this issue Dec 2, 2021 · 6 comments

Comments

@neheb
Copy link
Contributor

neheb commented Dec 2, 2021

https://gist.github.com/neheb/10cfc490b163bbee492231ba682cce7d

from a quick glance, these don't seem to be easily fixable. Not quite sure.

@KarlStraussberger
Copy link
Member

From my point of view, most of them are buffers that are acquired during startup and never freed because the "author" leaves this to happen on exit.

If we really observe a (slight) increase in memory during usage that's going to be critical in the long run.

@neheb
Copy link
Contributor Author

neheb commented Dec 2, 2021

well they are sorted by amount leaked :).

@neheb
Copy link
Contributor Author

neheb commented Dec 23, 2021

strange thing is, my raw branch now does not show any more leaks except for the ixml one. Although that's an internal libupnp one. Can't tell what fixed it. Could also be a clang update.

Anyway:

 19 =================================================================
 20 ==363111==ERROR: LeakSanitizer: detected memory leaks
 21
 22 Direct leak of 3264 byte(s) in 1 object(s) allocated from:
 23     #0 0x90684f in __interceptor_realloc (/home/mangix/devstuff/gerbera/addr/gerbera+0x90684f)
 24     #1 0x7f698f6cb2ef  (/lib64/libixml.so.11+0x42ef)
 25
 26 Direct leak of 17 byte(s) in 1 object(s) allocated from:
 27     #0 0x90684f in __interceptor_realloc (/home/mangix/devstuff/gerbera/addr/gerbera+0x90684f)
 28     #1 0x7f698f6e4563  (/lib64/libupnp.so.17+0xe563)
 29
 30 Direct leak of 4 byte(s) in 1 object(s) allocated from:
 31     #0 0x9064a7 in malloc (/home/mangix/devstuff/gerbera/addr/gerbera+0x9064a7)
 32     #1 0x7f698f6fcc9d  (/lib64/libupnp.so.17+0x26c9d)
 33
 34 SUMMARY: AddressSanitizer: 3285 byte(s) leaked in 3 allocation(s).

maybe 606d4d4 fixed.

@KarlStraussberger
Copy link
Member

There may be some static buffer that's allocated once and never freed - because it's freed on exit.

@neheb
Copy link
Contributor Author

neheb commented Dec 29, 2021

Aside from the libmatroska problem, there's no other issue. Closing.

@neheb neheb closed this as completed Dec 29, 2021
@neheb
Copy link
Contributor Author

neheb commented Dec 29, 2021

==33300==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x9399b7 in operator new(unsigned long) (/home/mangix/devstuff/gerbera/addr2/gerbera+0x9399b7)
    #1 0x7f07a43de621 in UpnpSendAdvertisementLowPower(int, int, int, int, int) /home/mangix/devstuff/npupnp/a/../src/api/upnpapi.cpp:1446:24
    #2 0x7f07a43de475 in UpnpSendAdvertisement(int, int) /home/mangix/devstuff/npupnp/a/../src/api/upnpapi.cpp:1400:41
    #3 0x7f07a43de4a4 in thread_autoadvertise(void*) /home/mangix/devstuff/npupnp/a/../src/api/upnpapi.cpp:1407:26
    #4 0x7f07a43e727d in void* std::__invoke_impl<void*, void* (*&)(void*), void*>(std::__invoke_other, void* (*&)(void*), void*&&) /usr/include/c++/11/bits/invoke.h:61:36
    #5 0x7f07a43e72ba in std::enable_if<is_invocable_r_v<void, void* (*&)(void*), void*>, void>::type std::__invoke_r<void, void* (*&)(void*), void*>(void* (*&)(void*), void*&&) /usr/include/c++/11/bits/invoke.h:111:28
    #6 0x7f07a43e55ba in std::_Function_handler<void (void*), void* (*)(void*)>::_M_invoke(std::_Any_data const&, void*&&) /usr/include/c++/11/bits/std_function.h:290:30
    #7 0xd5f00b in std::function<void (void*)>::operator()(void*) const /usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/bits/std_function.h:590:9
    #8 0x7f07a43f22aa in WorkerThread(void*) /home/mangix/devstuff/npupnp/a/../src/threadutil/ThreadPool.cpp:480:18
    #9 0x7f07a43f6385 in void* std::__invoke_impl<void*, void* (*)(void*), ThreadPool::Internal*>(std::__invoke_other, void* (*&&)(void*), ThreadPool::Internal*&&) /usr/include/c++/11/bits/invoke.h:61:36
    #10 0x7f07a43f6309 in std::__invoke_result<void* (*)(void*), ThreadPool::Internal*>::type std::__invoke<void* (*)(void*), ThreadPool::Internal*>(void* (*&&)(void*), ThreadPool::Internal*&&) /usr/include/c++/11/bits/invoke.h:96:40
    #11 0x7f07a43f627a in void* std::thread::_Invoker<std::tuple<void* (*)(void*), ThreadPool::Internal*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/11/bits/std_thread.h:253:26
    #12 0x7f07a43f6235 in std::thread::_Invoker<std::tuple<void* (*)(void*), ThreadPool::Internal*> >::operator()() /usr/include/c++/11/bits/std_thread.h:260:20
    #13 0x7f07a43f6219 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void* (*)(void*), ThreadPool::Internal*> > >::_M_run() /usr/include/c++/11/bits/std_thread.h:211:20
    #14 0x7f07a41ed5c3  (/lib64/libstdc++.so.6+0xd95c3)

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x901287 in malloc (/home/mangix/devstuff/gerbera/addr2/gerbera+0x901287)
    #1 0x7f07a43de602 in UpnpSendAdvertisementLowPower(int, int, int, int, int) /home/mangix/devstuff/npupnp/a/../src/api/upnpapi.cpp:1442:42
    #2 0x7f07a43de475 in UpnpSendAdvertisement(int, int) /home/mangix/devstuff/npupnp/a/../src/api/upnpapi.cpp:1400:41
    #3 0x7f07a43de4a4 in thread_autoadvertise(void*) /home/mangix/devstuff/npupnp/a/../src/api/upnpapi.cpp:1407:26
    #4 0x7f07a43e727d in void* std::__invoke_impl<void*, void* (*&)(void*), void*>(std::__invoke_other, void* (*&)(void*), void*&&) /usr/include/c++/11/bits/invoke.h:61:36
    #5 0x7f07a43e72ba in std::enable_if<is_invocable_r_v<void, void* (*&)(void*), void*>, void>::type std::__invoke_r<void, void* (*&)(void*), void*>(void* (*&)(void*), void*&&) /usr/include/c++/11/bits/invoke.h:111:28
    #6 0x7f07a43e55ba in std::_Function_handler<void (void*), void* (*)(void*)>::_M_invoke(std::_Any_data const&, void*&&) /usr/include/c++/11/bits/std_function.h:290:30
    #7 0xd5f00b in std::function<void (void*)>::operator()(void*) const /usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/bits/std_function.h:590:9
    #8 0x7f07a43f22aa in WorkerThread(void*) /home/mangix/devstuff/npupnp/a/../src/threadutil/ThreadPool.cpp:480:18
    #9 0x7f07a43f6385 in void* std::__invoke_impl<void*, void* (*)(void*), ThreadPool::Internal*>(std::__invoke_other, void* (*&&)(void*), ThreadPool::Internal*&&) /usr/include/c++/11/bits/invoke.h:61:36
    #10 0x7f07a43f6309 in std::__invoke_result<void* (*)(void*), ThreadPool::Internal*>::type std::__invoke<void* (*)(void*), ThreadPool::Internal*>(void* (*&&)(void*), ThreadPool::Internal*&&) /usr/include/c++/11/bits/invoke.h:96:40
    #11 0x7f07a43f627a in void* std::thread::_Invoker<std::tuple<void* (*)(void*), ThreadPool::Internal*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/11/bits/std_thread.h:253:26
    #12 0x7f07a43f6235 in std::thread::_Invoker<std::tuple<void* (*)(void*), ThreadPool::Internal*> >::operator()() /usr/include/c++/11/bits/std_thread.h:260:20
    #13 0x7f07a43f6219 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void* (*)(void*), ThreadPool::Internal*> > >::_M_run() /usr/include/c++/11/bits/std_thread.h:211:20
    #14 0x7f07a41ed5c3  (/lib64/libstdc++.so.6+0xd95c3)

SUMMARY: AddressSanitizer: 20 byte(s) leaked in 2 allocation(s).

is the output with libnpupnp. @medoc92 believes it is no issue. I agree. 20 leaked bytes is not much.

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

2 participants