jarro2783 / cxxopts

Lightweight C++ command line option parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cause memory leak when I run the code from https://github.com/yasenh/libtorch-yolov5.git

liubamboo opened this issue · comments

envs: ubuntu 18.04, libtorch 1.8.1, cxxopts

Hello, When I run the code from https://github.com/yasenh/libtorch-yolov5.git. the program memery is still increasing. After debugging, I find the key is that cxxopts conflict with libtorch.

when I use cxxopts in my main.cpp and load torch script by torch::jit::load, the bug sometime appears. The program memory is still increasing quickly and finally the program was killed by the operater system, and then there are some infomation like:
Process finished with exit code 9

Then I didn't use cxxopts and use gflags, The bug disappears.

So I think there are some conflicts between libtorch and cxxopts

Without a minimal working example I can't reproduce anything here. Given that cxxopts runs once to parse your arguments and isn't used after that I would be very surprised if that was causing a memory leak.

How are you using cxxopts? Is it being repeatedly called to parse things or only once?

Valgrind tells me that there are no memory leaks in the unit tests. Can you run under valgrind to find not freed memory?