Cross Reference: memleak.awk
xref
: /
osnet-11
/
usr
/
src
/
lib
/
libsqlite
/
tool
/
memleak.awk
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
2
N/A
2
N/A
#pragma ident "%Z%%M% %I% %E% SMI"
2
N/A
2
N/A
#
2
N/A
# This script looks for memory leaks by analyzing the output of "sqlite"
2
N/A
# when compiled with the MEMORY_DEBUG=2 option.
2
N/A
#
2
N/A
/[
0
-
9
]+
malloc
/
{
2
N/A
mem
[$
6
] = $
0
2
N/A
}
2
N/A
/[
0
-
9
]+
realloc
/
{
2
N/A
mem
[$
8
] =
""
;
2
N/A
mem
[$
10
] = $
0
2
N/A
}
2
N/A
/[
0
-
9
]+
free
/
{
2
N/A
if
(
mem
[$
6
]==
""
)
{
2
N/A
print
"*** free without a malloc at"
,$
6
2
N/A
}
2
N/A
mem
[$
6
] =
""
;
2
N/A
str
[$
6
] =
""
2
N/A
}
2
N/A
/^
string
at
/
{
2
N/A
addr
= $
4
2
N/A
sub
(
"string at "
addr
" is "
,
""
)
2
N/A
str
[
addr
] = $
0
2
N/A
}
2
N/A
END
{
2
N/A
for
(
addr
in
mem
)
{
2
N/A
if
(
mem
[
addr
]==
""
)
continue
2
N/A
print
mem
[
addr
],
str
[
addr
]
2
N/A
}
2
N/A
}