2 #pragma ident "%Z%%M% %I% %E% SMI"
4 # This AWK script reads the output of testfixture when compiled for memory
5 # debugging. It generates SQL commands that can be fed into an sqlite
6 # instance to determine what memory is never freed. A typical usage would
9 # make -f memleak.mk fulltest 2>mem.out
10 # awk -f ../sqlite/tool/memleak2.awk mem.out | ./sqlite :memory:
12 # The job performed by this script is the same as that done by memleak.awk.
13 # The difference is that this script uses much less memory when the size
14 # of the mem.out file is huge.
17 print "CREATE TABLE mem(loc INTEGER PRIMARY KEY, src);"
20 print "INSERT INTO mem VALUES(" strtonum
($
6) ",'" $
0 "');"
23 print "INSERT INTO mem VALUES(" strtonum
($
10) \
24 ",(SELECT src FROM mem WHERE loc=" strtonum
($
8) "));"
25 print "DELETE FROM mem WHERE loc=" strtonum
($
8) ";"
28 print "DELETE FROM mem WHERE loc=" strtonum
($
6) ";"
31 print "SELECT src FROM mem;"