From e36d23a85ebff914d74bb541558c2b6082b78edb Mon Sep 17 00:00:00 2001 From: dan miller Date: Sat, 20 Oct 2007 02:49:29 +0000 Subject: sqlite source (unix build) added to libraries --- .../sqlite/unix/sqlite-3.5.1/tool/memleak.awk | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libraries/sqlite/unix/sqlite-3.5.1/tool/memleak.awk (limited to 'libraries/sqlite/unix/sqlite-3.5.1/tool/memleak.awk') diff --git a/libraries/sqlite/unix/sqlite-3.5.1/tool/memleak.awk b/libraries/sqlite/unix/sqlite-3.5.1/tool/memleak.awk new file mode 100644 index 0000000..928d3b6 --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/tool/memleak.awk @@ -0,0 +1,29 @@ +# +# This script looks for memory leaks by analyzing the output of "sqlite" +# when compiled with the SQLITE_DEBUG=2 option. +# +/[0-9]+ malloc / { + mem[$6] = $0 +} +/[0-9]+ realloc / { + mem[$8] = ""; + mem[$10] = $0 +} +/[0-9]+ free / { + if (mem[$6]=="") { + print "*** free without a malloc at",$6 + } + mem[$6] = ""; + str[$6] = "" +} +/^string at / { + addr = $4 + sub("string at " addr " is ","") + str[addr] = $0 +} +END { + for(addr in mem){ + if( mem[addr]=="" ) continue + print mem[addr], str[addr] + } +} -- cgit v1.1