3

I have an ASAN instrumented 'deamon' process that always runs in my system. I see the memory leaks are reported only when the process exits. Is there anyway that i can ask LSAN to dump the leak reports without having to kill the process ? Is there any signal that i can send to process , so that it will detect and dump the leaks ?

subbu147
  • 346
  • 1
  • 9

1 Answers1

2

Use __lsan_do_leak_check:

  // Check for leaks now. This function behaves identically to the default
  // end-of-process leak check. In particular, it will terminate the process if
  // leaks are found and the exitcode runtime flag is non-zero.
  // Subsequent calls to this function will have no effect and end-of-process
  // leak check will not run. Effectively, end-of-process leak check is moved to
  // the time of first invocation of this function.
  // By calling this function early during process shutdown, you can instruct
  // LSan to ignore shutdown-only leaks which happen later on.
Employed Russian
  • 199,314
  • 34
  • 295
  • 362