Hi there !
I am facing an issue when running my app built from C++ code. It is basically an inference sample to detect objects in an image. I use libtorch to do load my model and do the inference.
The error arises only at the end of the program, with a Segmentation Fault that is thrown after the destruction of all my objects.
The debugger points to a llvm destructor, as described below :
Invalid free() / delete / delete / realloc() ==2964293== at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==2964293== by 0xAA67B3E: llvm::cl::Option::~Option() (in /home/jlquetin/Documents/tools/libtorch/lib/libtorch_cpu.so) ==2964293== by 0x1E9C8FDD: __cxa_finalize (cxa_finalize.c:83) ==2964293== by 0x66F23B2: ??? (in /home/jlquetin/Documents/tools/libtorch/lib/libtorch_cpu.so) ==2964293== by 0x4011F6A: _dl_fini (dl-fini.c:138) ==2964293== by 0x1E9C88A6: __run_exit_handlers (exit.c:108) ==2964293== by 0x1E9C8A5F: exit (exit.c:139) ==2964293== by 0x1E9A6089: (below main) (libc-start.c:342) ==2964293== Address 0x1 is not stack'd, malloc'd or (recently) free'd
Please note that the error doesn’t occur when I don’t use my specific UI (built internally) which uses OpenGL, GLE and glfw3. I have read some topics about library incompatibility but nothing clear to solve this issue. I am working on Ubuntu 20.04 and building my project with gcc 9.4.0 and libtorch 1.13.1.
Does anyone have a clue about the problem here ?