If you watched Fabian's [presentation][1] (or read the [transcript][2]) you'll have seen that he said you can use Valgrind for memory leak checks and that it can be used similarly to lldb.

    valgrind --leak-check=yes src/bitcoind -regtest

There is a section in Fabian's [doc][3] on debugging Bitcoin with instructions on how to install Valgrind on MacOS and run it.

Install Valgrind:

    brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb

Run bitcoind with Valgrind:

    sudo valgrind src/bitcoind -regtest

Valgrind has also been added as flag to the functional tests in Core in [PR #17633][4] so you can run:

    test/functional/test_runner.py --valgrind

The `--valgrind` flag is documented as a Valgrind memory error detector and that you should expect at least a ~10x slowdown with Valgrind 3.14 or later required.

But circling back to your initial question on when to use Valgrind if debugging Bitcoin Core. The best resource I could find is a Bitcoin Core PR review club [session][5] on running the unit tests under Valgrind. In the notes for that session it describes:

> Valgrind is a debugging and profiling tool suite to make programs faster and more correct. Its most popular tool, Memcheck, can detect memory-related errors common in C and C++ programs that can lead to crashes and unpredictable behavior. Here is a [tutorial][6]. Memcheck is not perfect: typical slowdown is 3-10x, memory usage is 2x, it can produce false positives (there are [mechanisms][7] for suppressing these; see the [valgrind.supp][8] file in Bitcoin Core), and it doesn’t currently detect out-of-range reads or writes to arrays allocated statically or on the stack.

                     


  [1]: https://www.youtube.com/watch?v=8bea0bdoFG0
  [2]: https://diyhpl.us/wiki/transcripts/scalingbitcoin/tel-aviv-2019/edgedevplusplus/debugging-bitcoin/
  [3]: https://github.com/fjahr/debugging_bitcoin#valgrind
  [4]: https://github.com/bitcoin/bitcoin/pull/17633
  [5]: https://bitcoincore.reviews/17639
  [6]: https://www.cprogramming.com/debugging/valgrind.html
  [7]: https://www.valgrind.org/docs/manual/manual-core.html#manual-core.suppress
  [8]: https://github.com/bitcoin/bitcoin/blob/0.19/contrib/valgrind.supp