From f7fa39a975ed6cc64b45f35ade94fffd3f3e3990 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 17 Nov 2021 04:06:36 +0100 Subject: [PATCH] track_memory.awk: option to disable source line display --- src/track_memory.awk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/track_memory.awk b/src/track_memory.awk index ea270504..30505e24 100755 --- a/src/track_memory.awk +++ b/src/track_memory.awk @@ -6,6 +6,7 @@ # 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. BEGIN{ + show_source = 1 max = 0 total = 0 malloc = 0 @@ -73,9 +74,11 @@ END{ stale++ leak+= address[i] print " address[ " i ", " idx[i] " ]= " address[i] - pipe = "egrep -n 'my_(malloc|calloc|realloc|free)\(" idx[i] ",' *.c xschem.h" - while( pipe | getline a) print " " a - close(pipe) + if(show_source) { + pipe = "egrep -n 'my_(malloc|calloc|realloc|free)\(" idx[i] ",' *.c xschem.h" + while( pipe | getline a) print " " a + close(pipe) + } } print "Number of unfreed pointers = " stale # as a crosscheck 'leak' should be equal to 'total'.