-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Build] memory leaked #23915
Comments
Most like this applies: #23798 (comment) There are some statics in 3rd party libraries like protobuf and cpuinfo that we can't free. |
|
static Session *session = nullptr; and in free function, i just delete session.can u tell me whether it is neceaasry to free env? |
Typically one would free the Ort::Env, but only once all usage of ORT has completed. You own the instance of that that you create. |
|
Describe the issue
i use valgrind to check memory leak
valgrind --log-file=vg.log --track-origins=yes --leak-check=full --show-leak-kinds=all --read-var-info=yes ./df_onnx_runtime_ort_linux ./ ./test.wav ./audio_linux.wav
the log is :
HEAP SUMMARY:
==96628== in use at exit: 18,960 bytes in 12 blocks
==96628== total heap usage: 3,156,447 allocs, 3,156,435 frees, 316,270,850 bytes allocated
==96628==
==96628== 16 bytes in 1 blocks are still reachable in loss record 1 of 12
==96628== at 0x4C3217F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F75726: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 64 bytes in 1 blocks are still reachable in loss record 2 of 12
==96628== at 0x4C3217F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F755F3: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x1F: ???
==96628== by 0x51A9DBF: ???
==96628== by 0x3: ???
==96628== by 0x4F757DB: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 256 bytes in 1 blocks are still reachable in loss record 3 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AEE8: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 288 bytes in 1 blocks are still reachable in loss record 4 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7ADCB: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 448 bytes in 1 blocks are still reachable in loss record 5 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AD7D: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 832 bytes in 1 blocks are still reachable in loss record 6 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AC82: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 832 bytes in 1 blocks are still reachable in loss record 7 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7ACE8: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 1,664 bytes in 1 blocks are still reachable in loss record 8 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AE17: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 1,664 bytes in 1 blocks are still reachable in loss record 9 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AE60: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 1,664 bytes in 1 blocks are still reachable in loss record 10 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AEA6: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 2,912 bytes in 1 blocks are still reachable in loss record 11 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7AD29: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== 8,320 bytes in 1 blocks are still reachable in loss record 12 of 12
==96628== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==96628== by 0x4F7A94E: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x5E16906: __pthread_once_slow (pthread_once.c:116)
==96628== by 0x4F7A532: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628== by 0x4F626EA: ??? (in /home/zhengxinjiang/code/DeepFilterNet-main/deepfilternet3_CPP/onnxruntime/lib/libonnxruntime.so.1)
==96628==
==96628== LEAK SUMMARY:
==96628== definitely lost: 0 bytes in 0 blocks
==96628== indirectly lost: 0 bytes in 0 blocks
==96628== possibly lost: 0 bytes in 0 blocks
==96628== still reachable: 18,960 bytes in 12 blocks
==96628== suppressed: 0 bytes in 0 blocks
==96628==
==96628== For counts of detected and suppressed errors, rerun with: -v
==96628== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Urgency
No response
Target platform
ubuntu18.04
Build script
python3 ./tools/ci_build/build.py
--build_dir ./build-ios/arm64
--skip_submodule_sync
--config=MinSizeRel
--minimal_build
--include_ops_by_config=required_operators_ORT.config
--use_xcode
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
--cmake_extra_defines onnxruntime_BUILD_SHARED_LIB=OFF
--ios
--apple_sysroot iphoneos
--osx_arch arm64
--parallel
--skip_tests
--build_apple_framework
--apple_deploy_target '13.0'
--compile_no_warning_as_error
Error / output
i found memory leak occur in libonnxruntime.so
Visual Studio Version
No response
GCC / Compiler Version
No response
The text was updated successfully, but these errors were encountered: