mediapipe
mediapipe copied to clipboard
Detected memory leaks by ASAN
System information
- Have I written custom code (as opposed to using a stock example script provided in MediaPipe): stock example
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04, Android 11, iOS 14.4): Linux Ubuntu 20.04
- Programming Language and version ( e.g. C++, Python, Java): C++
- MediaPipe version: latest
Describe the current behavior:
I've built hand tracking example with -fsanitize=address gcc option and a lot of leaks was detected. All of them connected with REGISTER_CALCULATOR macros.
I explored deeper to codebase and detected, that REGISTER_FACTORY_FUNCTION_QUALIFIED creates static pointer in global environment. Why?
Is it possible to change raw pointer to unique_ptr (aka smart pointer)? Or what are the reasons for using raw pointers here? I've already tried unique_ptr and all leaks went away.
Describe the expected behavior:
No leaks.
Other info / Complete Logs : Example of Log:
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x55a15ddb8528 in operator new(unsigned long)
#1 0x7f5c287858b1 in _GLOBAL__sub_I_packet_inner_join_calculator.cc
Hi @toshiks , Did you get a chance to check this issue https://github.com/google/mediapipe/issues/205
Hi @sureshdagooglecom ,
I've read issue #205. In my side application works stable. I note there, my target environment is the Desktop, it isn't Android. But I thinks, raw pointers can be the leak memory. In many places static variables are created by new operator. But I can't find any place where variables can be destructed by delete operator.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.
Closing as stale. Please reopen if you'd like to work on this further.
Closing as stale. Please reopen if you'd like to work on this further.
new operator usage there (registration) should be for global constants which are initialized only once and kept for the whole duration of program running.
If you see some other examples, could you please share them?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.