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
I am trying to implement models in C using onnxruntime version 1.12.0, (have also tried the newest version of onnxruntime) on a Linux machine. I face problems with memory leaks stemming from the environment creation. I have attached a part of the output from Valgrind.
The same problem i am facing in my code is appearing when trying to run the fns_candy_style_transfer example from the onnxruntime_examples. It seems to be the related to cpuinfo_x86_linux_init but i have not been able to find a fix. Any insight and help would greatly be appreciated.
==903287== HEAP SUMMARY:
==903287== in use at exit: 1,561,752 bytes in 13 blocks
==903287== total heap usage: 177,829 allocs, 177,816 frees, 332,261,137 bytes allocated
==903287==
==903287== 16 bytes in 1 blocks are still reachable in loss record 1 of 13
==903287== at 0x4846FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5854216: void std::vector<std::pair<void ()(void const), void const*>, std::allocator<std::pair<void ()(void const), void const*> > >::_M_realloc_insert<std::pair<void ()(void const), void const*> >(__gnu_cxx::__normal_iterator<std::pair<void ()(void const), void const*>, std::vector<std::pair<void ()(void const*), void const*>, std::allocator<std::pair<void ()(void const), void const*> > > >, std::pair<void ()(void const), void const*>&&) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5854392: google::protobuf::internal::OnShutdownRun(void ()(void const), void const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x58510B5: google::protobuf::internal::InitProtobufDefaultsSlow() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x400571E: call_init.part.0 (dl-init.c:74)
==903287== by 0x4005823: call_init (dl-init.c:120)
==903287== by 0x4005823: _dl_init (dl-init.c:121)
==903287== by 0x401F59F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==903287== by 0x4: ???
==903287== by 0x1FFEFFF556: ???
==903287== by 0x1FFEFFF571: ???
==903287== by 0x1FFEFFF5A0: ???
==903287== by 0x1FFEFFF5E2: ???
==903287==
==903287== 64 bytes in 1 blocks are still reachable in loss record 2 of 13
==903287== at 0x4846FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5854345: google::protobuf::internal::OnShutdownRun(void ()(void const), void const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x58510B5: google::protobuf::internal::InitProtobufDefaultsSlow() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x400571E: call_init.part.0 (dl-init.c:74)
==903287== by 0x4005823: call_init (dl-init.c:120)
==903287== by 0x4005823: _dl_init (dl-init.c:121)
==903287== by 0x401F59F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==903287== by 0x4: ???
==903287== by 0x1FFEFFF556: ???
==903287== by 0x1FFEFFF571: ???
==903287== by 0x1FFEFFF5A0: ???
==903287== by 0x1FFEFFF5E2: ???
==903287== by 0x1FFEFFF5F5: ???
==903287==
==903287== 192 bytes in 1 blocks are still reachable in loss record 3 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x58967B7: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 216 bytes in 1 blocks are still reachable in loss record 4 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895D3B: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 224 bytes in 1 blocks are still reachable in loss record 5 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895CB8: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 224 bytes in 1 blocks are still reachable in loss record 6 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895CD5: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 336 bytes in 1 blocks are still reachable in loss record 7 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895D19: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 640 bytes in 1 blocks are still reachable in loss record 8 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x589688F: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 640 bytes in 1 blocks are still reachable in loss record 9 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5896840: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 640 bytes in 1 blocks are still reachable in loss record 10 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x58967F7: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 1,120 bytes in 1 blocks are still reachable in loss record 11 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895CF7: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 2,240 bytes in 1 blocks are still reachable in loss record 12 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895818: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 1,555,200 bytes in 1 blocks are definitely lost in loss record 13 of 13
==903287== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x109459: chw_to_hwc (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287== by 0x109B37: run_inference (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287== by 0x10A1CE: main (in /test_of_fnsscandy/fns_candy_style_transfer)
To run the example, export the path to the release of onnxruntime on your pc using command below:
export LD_LIBRARY_PATH=/path/to/your/onnxruntime/build/Linux/Release:$LD_LIBRARY_PATH
Supply the correct inputs to the script, args: input image, output image and run it using valgrind with the following arguments:
valgrind --leak-check=full --show-leak-kinds=all ./fns_candy_style_transfer model <model_path> <input_file> <output_file>
Urgency
The matter is somewhat urgent as i am trying to create a prototype to asses the feasibility in my current platform, such i can make necessary platform choices.
Platform
Linux
OS Version
Ubuntu 24.04.1 LTS
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.12.0
ONNX Runtime API
C
Architecture
X86
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered:
Krissaren
changed the title
Memory leakage from environemnt from environment on Linux machine using C.
Memory leakage from ONNX environment on Linux machine using C.
Feb 24, 2025
Describe the issue
I am trying to implement models in C using onnxruntime version 1.12.0, (have also tried the newest version of onnxruntime) on a Linux machine. I face problems with memory leaks stemming from the environment creation. I have attached a part of the output from Valgrind.
The same problem i am facing in my code is appearing when trying to run the fns_candy_style_transfer example from the onnxruntime_examples. It seems to be the related to cpuinfo_x86_linux_init but i have not been able to find a fix. Any insight and help would greatly be appreciated.
==903287== HEAP SUMMARY:
==903287== in use at exit: 1,561,752 bytes in 13 blocks
==903287== total heap usage: 177,829 allocs, 177,816 frees, 332,261,137 bytes allocated
==903287==
==903287== 16 bytes in 1 blocks are still reachable in loss record 1 of 13
==903287== at 0x4846FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5854216: void std::vector<std::pair<void ()(void const), void const*>, std::allocator<std::pair<void ()(void const), void const*> > >::_M_realloc_insert<std::pair<void ()(void const), void const*> >(__gnu_cxx::__normal_iterator<std::pair<void ()(void const), void const*>, std::vector<std::pair<void ()(void const*), void const*>, std::allocator<std::pair<void ()(void const), void const*> > > >, std::pair<void ()(void const), void const*>&&) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5854392: google::protobuf::internal::OnShutdownRun(void ()(void const), void const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x58510B5: google::protobuf::internal::InitProtobufDefaultsSlow() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x400571E: call_init.part.0 (dl-init.c:74)
==903287== by 0x4005823: call_init (dl-init.c:120)
==903287== by 0x4005823: _dl_init (dl-init.c:121)
==903287== by 0x401F59F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==903287== by 0x4: ???
==903287== by 0x1FFEFFF556: ???
==903287== by 0x1FFEFFF571: ???
==903287== by 0x1FFEFFF5A0: ???
==903287== by 0x1FFEFFF5E2: ???
==903287==
==903287== 64 bytes in 1 blocks are still reachable in loss record 2 of 13
==903287== at 0x4846FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5854345: google::protobuf::internal::OnShutdownRun(void ()(void const), void const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x58510B5: google::protobuf::internal::InitProtobufDefaultsSlow() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x400571E: call_init.part.0 (dl-init.c:74)
==903287== by 0x4005823: call_init (dl-init.c:120)
==903287== by 0x4005823: _dl_init (dl-init.c:121)
==903287== by 0x401F59F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==903287== by 0x4: ???
==903287== by 0x1FFEFFF556: ???
==903287== by 0x1FFEFFF571: ???
==903287== by 0x1FFEFFF5A0: ???
==903287== by 0x1FFEFFF5E2: ???
==903287== by 0x1FFEFFF5F5: ???
==903287==
==903287== 192 bytes in 1 blocks are still reachable in loss record 3 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x58967B7: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 216 bytes in 1 blocks are still reachable in loss record 4 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895D3B: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 224 bytes in 1 blocks are still reachable in loss record 5 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895CB8: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 224 bytes in 1 blocks are still reachable in loss record 6 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895CD5: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 336 bytes in 1 blocks are still reachable in loss record 7 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895D19: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 640 bytes in 1 blocks are still reachable in loss record 8 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x589688F: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 640 bytes in 1 blocks are still reachable in loss record 9 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5896840: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 640 bytes in 1 blocks are still reachable in loss record 10 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x58967F7: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 1,120 bytes in 1 blocks are still reachable in loss record 11 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895CF7: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 2,240 bytes in 1 blocks are still reachable in loss record 12 of 13
==903287== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x5895818: cpuinfo_x86_linux_init (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x5D04ED2: __pthread_once_slow (pthread_once.c:116)
==903287== by 0x58952FA: cpuinfo_initialize (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D50FB: onnxruntime::(anonymous namespace)::PosixEnv::PosixEnv() [clone .constprop.0] (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x56D580E: onnxruntime::Env::Default() (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B34789: onnxruntime::Environment::Initialize(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4B37220: onnxruntime::Environment::Create(std::unique_ptr<onnxruntime::logging::LoggingManager, std::default_deleteonnxruntime::logging::LoggingManager >, std::unique_ptr<onnxruntime::Environment, std::default_deleteonnxruntime::Environment >&, OrtThreadingOptions const*, bool) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4AD11EA: OrtEnv::GetInstance(OrtEnv::LoggingManagerConstructionInfo const&, onnxruntime::common::Status&, OrtThreadingOptions const*) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x4ABA476: OrtApis::CreateEnv(OrtLoggingLevel, char const*, OrtEnv**) (in /test_of_fnsscandy/onnxruntime/build/Linux/Release/libonnxruntime.so.1.21.0)
==903287== by 0x109F45: main (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287==
==903287== 1,555,200 bytes in 1 blocks are definitely lost in loss record 13 of 13
==903287== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==903287== by 0x109459: chw_to_hwc (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287== by 0x109B37: run_inference (in /test_of_fnsscandy/fns_candy_style_transfer)
==903287== by 0x10A1CE: main (in /test_of_fnsscandy/fns_candy_style_transfer)
To reproduce
To reproduce the issue simply compile and run the fns_candy_style_transfer example from the onnxruntime inference examples, link: (https://github.com/microsoft/onnxruntime-inference-examples/tree/main/c_cxx/fns_candy_style_transfer).
To run the example, export the path to the release of onnxruntime on your pc using command below:
export LD_LIBRARY_PATH=/path/to/your/onnxruntime/build/Linux/Release:$LD_LIBRARY_PATH
Supply the correct inputs to the script, args: input image, output image and run it using valgrind with the following arguments:
valgrind --leak-check=full --show-leak-kinds=all ./fns_candy_style_transfer model <model_path> <input_file> <output_file>
Urgency
The matter is somewhat urgent as i am trying to create a prototype to asses the feasibility in my current platform, such i can make necessary platform choices.
Platform
Linux
OS Version
Ubuntu 24.04.1 LTS
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.12.0
ONNX Runtime API
C
Architecture
X86
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: