summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite/tool/memleak.awk
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-01-07 05:27:27 +0000
committerWez Furlong <wez@php.net>2005-01-07 05:27:27 +0000
commite6c282a76639fe4b6e9166210b4f338b83df44e7 (patch)
tree6b0cb08f8b1efc397477efcfff0bbffaedbe0f36 /ext/pdo_sqlite/sqlite/tool/memleak.awk
parent02d6b65c672835f27fd2b160338ab05f1dfca3a1 (diff)
downloadphp-git-e6c282a76639fe4b6e9166210b4f338b83df44e7.tar.gz
jumbo commit; implement sqlstate error codes.
Bundle sqlite3
Diffstat (limited to 'ext/pdo_sqlite/sqlite/tool/memleak.awk')
-rw-r--r--ext/pdo_sqlite/sqlite/tool/memleak.awk29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/sqlite/tool/memleak.awk b/ext/pdo_sqlite/sqlite/tool/memleak.awk
new file mode 100644
index 0000000000..185f174897
--- /dev/null
+++ b/ext/pdo_sqlite/sqlite/tool/memleak.awk
@@ -0,0 +1,29 @@
+#
+# This script looks for memory leaks by analyzing the output of "sqlite"
+# when compiled with the MEMORY_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]
+ }
+}