A Linux based docker container containing valgrind and other usefull tools not installed by default.
Run the following command to automatically download the script and install the docker image.
sh -c "$(curl -L https://raw.githubusercontent.com/assemblycalamity/valiantdocker/refs/heads/main/valiant_docker.sh)"
- Valgrind memory analysis tools
- GDB debugger
- Other development utilities
- Pre-configured for C/C++ development
- Compatible with 42 school projects
valiant-build- Build the docker image (only needed once or after updates).valiant-start- Start a new docker container with the built image.dock- start docker, especially if it is failing to start.
- Your current directory is automatically mounted inside the container at
/code - Any changes made to files will persist on your host machine
- To run valgrind on your program:
cd /code make # Compile your project valgrind ./your_program [args]
- Basic memory leak check:
valgrind --leak-check=full ./your_program - Detailed leak checking with origin tracking:
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./your_program - Save output to a file:
valgrind --leak-check=full --log-file=valgrind-report.txt ./your_program - For the paranoid
valgrind --leak-check=full --leak-resolution=high -s --track-origins=yes \ --num-callers=500 --show-mismatched-frees=yes --show-leak-kinds=all \ --track-fds=yes --trace-children=yes --gen-suppressions=no \ --error-limit=no --undef-value-errors=yes --expensive-definedness-checks=yes \ --malloc-fill=0x41 --free-fill=0x42 --read-var-info=yes --keep-debuginfo=yes \ --show-realloc-size-zero=yes --partial-loads-ok=no \ ./your_program
Custom aliases can be configured and edited in the ~/.valiant-aliases file.
Some useful aliases that are already set up:
val- Run valgrind with common memory checking parameters
Type exit or press Ctrl+D to leave the container shell.
If you encounter any issues:
- Make sure Docker is installed and running
- Try rebuilding the container with
valiant-build - Ensure you have read/write permissions for the current directory
- Run the script again
Feel free to contribute to this project by submitting issues or pull requests on GitHub.