2

我有一个始终在我的系统中运行的 ASAN 检测“守护程序”进程。我看到只有在进程退出时才报告内存泄漏。无论如何,我可以要求 LSAN 转储泄漏报告而不必终止进程吗?是否有任何信号可以发送给处理,以便它检测并转储泄漏?

4

1 回答 1

1

使用__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.
于 2020-03-11T02:52:37.587 回答