astobj2.c/refcounter.py: Fix to deal with invalid object refs.
[asterisk/asterisk.git] / contrib / scripts / valgrind_compare
1 #!/bin/bash
2
3 # compare_valgrind: diff two valgrinf memory usage logs. Masks out PIDs,
4 # addresses and such that should normally be different.
5 #
6 # Usage: ./compare_valgrind file1.log file2.log | less
7 #
8 # (Requires /bin/bash due to usage of '<()' )
9
10 log1="$1"
11 log2="$2"
12
13 pipe_log() {
14         sed \
15                 -e 's/^--[0-9]\+-- //' -e 's/^==[0-9]\+== //' "$1" \
16                 -e 's/ record [0-9]\+ of [0-9]\+$/ <snipped>/' \
17                 -e 's/^ Address 0x[0-9a-f]\+/ Address 0x<snipped>/' \
18
19 }
20
21 diff -u -L "$log1" <(pipe_log "$log1") -L "$log2" <(pipe_log "$log2")