You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, there!
I've started to work with onnxruntime lib aproximately 2 mounth ago. I've tried to search for documentation for C++ and found some inferencing examples from ultralitycs and others (including your examples). After all i succesfuly run model inferencing and spent some time for postprocessing. However, I decided to check my code for memory leaks and other problems using GCC sanitizer and found some memory leaks. After endless attempts to fix it, I still didn't understand why my code causes memory leaks, so i decided to check docs examples for memory leaks. And GCC sanitizer found it:
==3972466==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 128 byte(s) in 1 object(s) allocated from:
#0 0x7fc26e8d5a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154#1 0x7fc26e3b4df9 (/usr/local/lib/libonnxruntime.so.1.18.0+0xa2cdf9)
Direct leak of 128 byte(s) in 1 object(s) allocated from:
#0 0x7fc26e8d5a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154#1 0x7fc26e3b4ddd (/usr/local/lib/libonnxruntime.so.1.18.0+0xa2cddd)
Ort::Env is a singleton that is only needed once for process lifetime, and you cannot create it more than once. However, attempting to destroy it would cause some DLLs unload.
A small piece of memory is leaked intentionally and will not lead to any adverse consequences given it is a singlton.
Isn't this strange?
I mean intentional memory leakage is not something that is meant to be a "normal thing".
Is there some more complicated explanation why things are "that way" or why we can't fix this leakage.
Describe the issue
Hi, there!
I've started to work with onnxruntime lib aproximately 2 mounth ago. I've tried to search for documentation for
C++
and found some inferencing examples fromultralitycs
and others (including yourexamples
). After all i succesfuly run model inferencing and spent some time for postprocessing. However, I decided to check my code for memory leaks and other problems usingGCC
sanitizer and found somememory leaks
. After endless attempts to fix it, I still didn't understand why my code causes memory leaks, so i decided to check docs examples formemory leaks
. AndGCC
sanitizer found it:I've used this example.
They all will cause the same leak with no explainings (i've tried to find symbols by adress that sanitizer gives me, but it was no use)
To reproduce
This was my
Cmake
:If i run this code it will cause
memory leaks
:Or this one:
With
ASAN_OPTIONS=fast_unwind_on_malloc=0
:Urgency
Need to figure it out in order to integrate it into the project
Platform
Linux
OS Version
Mint 20.3
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.18.1
ONNX Runtime API
C++
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
Model File
No response
Is this a quantized model?
Yes
The text was updated successfully, but these errors were encountered: