From fbf698e76e2a0a3e702a5a1be62d6c2b61bb8b0a Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 19 Apr 2026 01:39:52 -0400 Subject: [PATCH] bench: refactor to use dynamic memory allocation in `strided/base/dmap` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../strided/base/dmap/benchmark/c/benchmark.length.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/strided/base/dmap/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/strided/base/dmap/benchmark/c/benchmark.length.c index 3fb224ef02c6..78297a89943a 100644 --- a/lib/node_modules/@stdlib/strided/base/dmap/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/strided/base/dmap/benchmark/c/benchmark.length.c @@ -106,11 +106,13 @@ static double identity( const double x ) { */ static double benchmark( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *)malloc( len * sizeof( double ) ); + y = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; y[ i ] = 0.0; @@ -128,6 +130,8 @@ static double benchmark( int iterations, int len ) { if ( y[ i%len ] != y[ i%len ] ) { printf( "should not return NaN\n" ); } + free( x ); + free( y ); return elapsed; }