From e0c5691110f38f63d1955a711fc7f786333bcaad Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Fri, 23 Oct 2020 19:16:45 -0400 Subject: Fix heap corruption in the stitch benchmark and tweak some heap limits --- .../benchmarks/disparity/src/c/script_disparity.c | 3 ++- SD-VBS/benchmarks/stitch/src/c/script_stitch.c | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c index 7d45ada..58a9e06 100644 --- a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c +++ b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c @@ -7,7 +7,8 @@ Author: Sravanthi Kota Venkata #include "disparity.h" #include #include "extra.h" -#define DISPARITY_MEM 1<<24 +// Valgrind says we use ~67Mb for fullhd - round up to 128Mb +#define DISPARITY_MEM 1<<27 int main(int argc, char* argv[]) { SET_UP diff --git a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c index 9310048..ee68e70 100644 --- a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c +++ b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c @@ -5,7 +5,8 @@ Author: Sravanthi Kota Venkata #include "stitch.h" #include #include "extra.h" -#define STITCH_MEM 1<<30 +// Valgrind says we use 250Mb of heap - round up to 512Mb +#define STITCH_MEM 1<<29 int main(int argc, char* argv[]) { SET_UP @@ -16,6 +17,7 @@ int main(int argc, char* argv[]) I2D *Icur; int i, j; char im1[100], im2[100]; + x = y = v = Fcur = int1 = int2 = interestPnts = NULL; scanf("%s", im1); Icur = readImage(im1); @@ -23,12 +25,11 @@ int main(int argc, char* argv[]) cols = Icur->width; for_each_job { - iFreeHandle(Icur); - fFreeHandle(v); - fFreeHandle(interestPnts); - fFreeHandle(int1); - fFreeHandle(int2); - fFreeHandle(Fcur); + fFreeHandle(v); + fFreeHandle(interestPnts); + fFreeHandle(int1); + fFreeHandle(int2); + fFreeHandle(Fcur); v = harris(Icur); interestPnts = getANMS(v, 24); int1 = fMallocHandle(interestPnts->height, 1); @@ -56,5 +57,11 @@ int main(int argc, char* argv[]) } #endif WRITE_TO_FILE + fFreeHandle(Icur); + fFreeHandle(v); + fFreeHandle(interestPnts); + fFreeHandle(int1); + fFreeHandle(int2); + fFreeHandle(Fcur); return 0; } -- cgit v1.2.2