~ubuntu-branches/ubuntu/karmic/gears/karmic

« back to all changes in this revision

Viewing changes to third_party/sqlite_google/tool/memleak.awk

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Lesicnik
  • Date: 2009-04-30 19:15:25 UTC
  • Revision ID: james.westby@ubuntu.com-20090430191525-0790sb5wzg8ou0xb
Tags: upstream-0.5.21.0~svn3334+dfsg
ImportĀ upstreamĀ versionĀ 0.5.21.0~svn3334+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This script looks for memory leaks by analyzing the output of "sqlite" 
 
3
# when compiled with the SQLITE_DEBUG=2 option.
 
4
#
 
5
/[0-9]+ malloc / {
 
6
  mem[$6] = $0
 
7
}
 
8
/[0-9]+ realloc / {
 
9
  mem[$8] = "";
 
10
  mem[$10] = $0
 
11
}
 
12
/[0-9]+ free / {
 
13
  if (mem[$6]=="") {
 
14
    print "*** free without a malloc at",$6
 
15
  }
 
16
  mem[$6] = "";
 
17
  str[$6] = ""
 
18
}
 
19
/^string at / {
 
20
  addr = $4
 
21
  sub("string at " addr " is ","")
 
22
  str[addr] = $0
 
23
}
 
24
END {
 
25
  for(addr in mem){
 
26
    if( mem[addr]=="" ) continue
 
27
    print mem[addr], str[addr]
 
28
  }
 
29
}