1

I got a service, and running in my local, when I stopped the service, ASAN give me memory leak messages. So I tried to use Valgrind to find where it got leaked, but there is no such errors.

I run it with

valgrind --leak-check=full --show-leak-kinds=all --verbose --log-file=out.txt /my/path/to/myshell -m myservice.py

"/my/path/to/myshell -m myservice.py" is the way to start my service in my local.

myshell invokes a Python customer interpreter with os.execve

and after I stopped my service, I see ASAN is giving me a lot of messages about memory leak, but in out.txt, I see the pid, which is the same process as I run ps -ef, but there is no memory leak info at all. where is wrong?

code3
  • 81
  • 1
  • 8

1 Answers1

2

If you intend to run the program under valgrind, then don't compile with ASAN. They do not work together.

Recompile without -fsanitize=address and try again.

You also need the --trace-children=yes flag to valgrind in order for it to check subprocesses executed by execve.

user17732522
  • 53,019
  • 2
  • 56
  • 105
  • I compiled without ASAN enabled, but still no output. – code3 Dec 30 '21 at 20:50
  • @code3 You probably also want to add the `--trace-children` flag to `valgrind` since it seems that your actual program is run only a few subprocesses down. You might want to put the `valgrind` call into the `os.execve` directly to avoid noise from the other processes. – user17732522 Dec 30 '21 at 20:52