From afcfb8ee7b005edeba8163f00ce5300cf77ede85 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 11 Feb 2021 19:49:26 -0500 Subject: Fix a memory leak in the SD-VBS "tracking" benchmark We were leaking the results and some intermediate state every job. Also updates the size of the preallocated memory to 16MB (should be plenty, as the WSS per Massif is only ~1MB for qcif). --- SD-VBS/benchmarks/tracking/src/c/script_tracking.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'SD-VBS/benchmarks/tracking/src/c/script_tracking.c') diff --git a/SD-VBS/benchmarks/tracking/src/c/script_tracking.c b/SD-VBS/benchmarks/tracking/src/c/script_tracking.c index c0af2d7..a2c1930 100644 --- a/SD-VBS/benchmarks/tracking/src/c/script_tracking.c +++ b/SD-VBS/benchmarks/tracking/src/c/script_tracking.c @@ -5,7 +5,7 @@ Author: Sravanthi Kota Venkata #include "tracking.h" #include #include "extra.h" -#define TRACKING_MEM 1<<29 +#define TRACKING_MEM 1<<24 int main(int argc, char* argv[]) { @@ -16,7 +16,7 @@ int main(int argc, char* argv[]) int endR, endC; F2D *blurredImage, *previousFrameBlurred_level1, *previousFrameBlurred_level2, *blurred_level1, *blurred_level2; F2D *verticalEdgeImage, *horizontalEdgeImage, *verticalEdge_level1, *verticalEdge_level2, *horizontalEdge_level1, *horizontalEdge_level2, *interestPnt; - F2D *lambda, *lambdaTemp, *features; + F2D *lambda, *lambdaTemp, *features = NULL; I2D *Ic, *status; float SUPPRESION_RADIUS; F2D *newpoints; @@ -105,6 +105,10 @@ int main(int argc, char* argv[]) cols = Ic->width; for_each_job { + // Clean up results from last job + if (features) + fFreeHandle(features); + /** IMAGE PRE-PROCESSING **/ /** Blur the image to remove noise - weighted avergae filter **/ @@ -225,6 +229,8 @@ int main(int argc, char* argv[]) features = fDeepCopy(newpoints); fFreeHandle(newpoints); } + fFreeHandle(blurred_level1); + fFreeHandle(blurred_level2); } #ifdef CHECK /* Self checking */ @@ -239,9 +245,7 @@ int main(int argc, char* argv[]) printf("Error in Tracking Map\n"); } #endif - - fFreeHandle(blurred_level1); - fFreeHandle(blurred_level2); + fFreeHandle(features); for(count=1; count<=counter; count++) -- cgit v1.2.2