sqlite/tool/memleak.awk
drh 6d4abfbee5 More changes for 2.0.7. (CVS 293)
FossilOrigin-Name: f8328a5f11801c5124f9a8dace22df3c1cfb2191
2001-10-22 02:58:08 +00:00

27 lines
425 B
Awk

#
# This script looks for memory leaks by analyzing the output of "sqlite"
# when compiled with the MEMORY_DEBUG=2 option.
#
/^malloc / {
mem[$5] = $0
}
/^realloc / {
mem[$7] = "";
mem[$9] = $0
}
/^free / {
mem[$5] = "";
str[$5] = ""
}
/^string at / {
addr = $3
sub("string at " addr " is ","")
str[addr] = $0
}
END {
for(addr in mem){
if( mem[addr]=="" ) continue
print mem[addr], str[addr]
}
}