Compile your Rust program with debug symbols and run Valgrind's memcheck tool on the resulting binary to detect memory errors.
rustc --debug src/main.rs -o my_program
valgrind --leak-check=full ./my_program
Valgrind will report memory leaks, invalid reads/writes, and use of uninitialized memory, which is critical for Rust code using unsafe blocks or custom allocators like those in LeafNode or InternalNode.