summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite/tool/memleak2.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/memleak2.awk
parent02d6b65c672835f27fd2b160338ab05f1dfca3a1 (diff)
downloadphp-git-e6c282a76639fe4b6e9166210b4f338b83df44e7.tar.gz
jumbo commit; implement sqlstate error codes.
Bundle sqlite3
Diffstat (limited to 'ext/pdo_sqlite/sqlite/tool/memleak2.awk')
-rw-r--r--ext/pdo_sqlite/sqlite/tool/memleak2.awk29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/sqlite/tool/memleak2.awk b/ext/pdo_sqlite/sqlite/tool/memleak2.awk
new file mode 100644
index 0000000000..5d81b70d8d
--- /dev/null
+++ b/ext/pdo_sqlite/sqlite/tool/memleak2.awk
@@ -0,0 +1,29 @@
+# This AWK script reads the output of testfixture when compiled for memory
+# debugging. It generates SQL commands that can be fed into an sqlite
+# instance to determine what memory is never freed. A typical usage would
+# be as follows:
+#
+# make -f memleak.mk fulltest 2>mem.out
+# awk -f ../sqlite/tool/memleak2.awk mem.out | ./sqlite :memory:
+#
+# The job performed by this script is the same as that done by memleak.awk.
+# The difference is that this script uses much less memory when the size
+# of the mem.out file is huge.
+#
+BEGIN {
+ print "CREATE TABLE mem(loc INTEGER PRIMARY KEY, src);"
+}
+/[0-9]+ malloc / {
+ print "INSERT INTO mem VALUES(" strtonum($6) ",'" $0 "');"
+}
+/[0-9]+ realloc / {
+ print "INSERT INTO mem VALUES(" strtonum($10) \
+ ",(SELECT src FROM mem WHERE loc=" strtonum($8) "));"
+ print "DELETE FROM mem WHERE loc=" strtonum($8) ";"
+}
+/[0-9]+ free / {
+ print "DELETE FROM mem WHERE loc=" strtonum($6) ";"
+}
+END {
+ print "SELECT src FROM mem;"
+}