track_memory.awk: option to disable source line display
This commit is contained in:
parent
dfc8031786
commit
f7fa39a975
|
|
@ -6,6 +6,7 @@
|
||||||
# and the allocation that was not freed, with the source code line.
|
# and the allocation that was not freed, with the source code line.
|
||||||
# total and leak should indicate same amount of bytes, it is a cross check for the script.
|
# total and leak should indicate same amount of bytes, it is a cross check for the script.
|
||||||
BEGIN{
|
BEGIN{
|
||||||
|
show_source = 1
|
||||||
max = 0
|
max = 0
|
||||||
total = 0
|
total = 0
|
||||||
malloc = 0
|
malloc = 0
|
||||||
|
|
@ -73,9 +74,11 @@ END{
|
||||||
stale++
|
stale++
|
||||||
leak+= address[i]
|
leak+= address[i]
|
||||||
print " address[ " i ", " idx[i] " ]= " address[i]
|
print " address[ " i ", " idx[i] " ]= " address[i]
|
||||||
pipe = "egrep -n 'my_(malloc|calloc|realloc|free)\(" idx[i] ",' *.c xschem.h"
|
if(show_source) {
|
||||||
while( pipe | getline a) print " " a
|
pipe = "egrep -n 'my_(malloc|calloc|realloc|free)\(" idx[i] ",' *.c xschem.h"
|
||||||
close(pipe)
|
while( pipe | getline a) print " " a
|
||||||
|
close(pipe)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print "Number of unfreed pointers = " stale
|
print "Number of unfreed pointers = " stale
|
||||||
# as a crosscheck 'leak' should be equal to 'total'.
|
# as a crosscheck 'leak' should be equal to 'total'.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue