Software versions:
JetPack: 5.0.1
CUDA: 11.4
TensorRT: 8.4.0.11
CuDNN: 8.3.2.49
Valgrine: 3.19.0
Problem description:
We run a valgrine
memory leak check on trtexec
the MINST onnx model installed with TensorRT samples, with the following commands.
valgrind --tool=memcheck --leak-check=full -- trtexec --onnx=/usr/src/tensorrt/data/mnist/mnist.onnx
The valgrind reports 468 bytes of definitely lost.
The call stacks is as follows:
==353287== 20 bytes in 1 blocks are definitely lost in loss record 82 of 4,025
==353287== at 0x484B0C8: malloc (vg_replace_malloc.c:381)
==353287== by 0x4B8BD267: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libnvcucompat.so)
==353287== by 0x470A3A8F: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1.1)
==353287== by 0x47019F17: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1.1)
==353287== by 0x4709836B: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1.1)
==353287== by 0x471895BF: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1.1)
==353287== by 0x4719247F: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1.1)
==353287== by 0x47003443: ??? (in /usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1.1)
==353287== by 0x2108F81F: ??? (in /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart.so.11.4.167)
==353287== by 0x2109231B: ??? (in /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart.so.11.4.167)
==353287== by 0x21137DF3: __pthread_once_slow (pthread_once.c:116)
==353287== by 0x210D0893: ??? (in /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart.so.11.4.167)
From the report we know malloc
called by libnvcucompat.so
causes the memory leak.
Is this a real memory leak problem or a false-positive report? and how to solve it?