From 04d6d89c28852df4f1bdc4c12f451c6910da0813 Mon Sep 17 00:00:00 2001 From: Uday Kakade Date: Mon, 20 Apr 2026 23:57:30 +0530 Subject: [PATCH] bench: refactor to use dynamic memory allocation in stats/strided/dmaxabssorted --- .../strided/dmaxabssorted/benchmark/c/benchmark.length.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/strided/dmaxabssorted/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmaxabssorted/benchmark/c/benchmark.length.c index 98bca32d4526..40351dd8914e 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmaxabssorted/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmaxabssorted/benchmark/c/benchmark.length.c @@ -86,11 +86,12 @@ static double tic( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = i - (len/2); } @@ -108,6 +109,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -120,11 +122,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = i - (len/2); } @@ -142,6 +145,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; }