Valgrind memory leak detection on macOS

Valgrind is a dynamic analysis tool that can detect memory leaks and other problems in programs including C, C++, and Fortran. Valgrind is available on Linux and BSD for x86 and ARM CPU architectures. For macOS on Intel x86 CPUs, Valgrind is available in Homebrew. For macOS on Apple Silicon ARM64 CPU, Valgrind can be used from an aarch64 Linux virtual machine in native mode for best performance.