chore: add valgrind script
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
|
||||
bin/*
|
||||
!bin/.gitkeep
|
||||
|
||||
valgrind.log
|
||||
|
22
scripts/valgrind_check.sh
Executable file
22
scripts/valgrind_check.sh
Executable 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 $@
|
Reference in New Issue
Block a user