2000-06-08 17:36:40 +04:00
|
|
|
#
|
|
|
|
# This script looks for memory leaks by analyzing the output of "sqlite"
|
2005-01-03 04:32:59 +03:00
|
|
|
# when compiled with the SQLITE_DEBUG=2 option.
|
2000-06-08 17:36:40 +04:00
|
|
|
#
|
2002-08-25 22:29:11 +04:00
|
|
|
/[0-9]+ malloc / {
|
|
|
|
mem[$6] = $0
|
2000-06-08 17:36:40 +04:00
|
|
|
}
|
2002-08-25 22:29:11 +04:00
|
|
|
/[0-9]+ realloc / {
|
|
|
|
mem[$8] = "";
|
|
|
|
mem[$10] = $0
|
2000-06-08 17:36:40 +04:00
|
|
|
}
|
2002-08-25 22:29:11 +04:00
|
|
|
/[0-9]+ free / {
|
2004-01-31 22:22:56 +03:00
|
|
|
if (mem[$6]=="") {
|
|
|
|
print "*** free without a malloc at",$6
|
|
|
|
}
|
2002-08-25 22:29:11 +04:00
|
|
|
mem[$6] = "";
|
|
|
|
str[$6] = ""
|
2000-06-08 17:36:40 +04:00
|
|
|
}
|
|
|
|
/^string at / {
|
2002-08-25 22:29:11 +04:00
|
|
|
addr = $4
|
2000-06-08 17:36:40 +04:00
|
|
|
sub("string at " addr " is ","")
|
|
|
|
str[addr] = $0
|
|
|
|
}
|
|
|
|
END {
|
|
|
|
for(addr in mem){
|
|
|
|
if( mem[addr]=="" ) continue
|
|
|
|
print mem[addr], str[addr]
|
|
|
|
}
|
|
|
|
}
|