chore: add valgrind script

This commit is contained in:
2025-08-28 14:52:48 +02:00
parent 6c5041543c
commit e9fd71f26a
3 changed files with 24 additions and 0 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
bin/* bin/*
!bin/.gitkeep !bin/.gitkeep
valgrind.log

View File

22
scripts/valgrind_check.sh Executable file
View File

@@ -0,0 +1,22 @@
#! /usr/bin/env sh
# valgrind_check.sh
# Run the program with Valgrind to detect memory issues.
main() {
local program="./bin/program"
local valgrind_log="./valgrind.log"
local valgrind_flags="--leak-check=full --show-leak-kinds=all --track-origins=yes --verbose"
if [[ ! -f "$program" ]]; then
echo "Error: Program '$program' not found. Build it first."
exit 1
fi
echo "Running Valgrind on $program..."
valgrind $valgrind_flags --log-file="$valgrind_log" "$program"
echo "Valgrind run complete. Output saved in $valgrind_log"
}
main $@