From 6cd937963e6566e0028ab47e8a87a22737953bb4 Mon Sep 17 00:00:00 2001 From: Samarth Kolarkar Date: Thu, 18 Dec 2025 15:09:50 +0530 Subject: [PATCH 1/2] bench: refactor to use dynamic memory allocation in blas/base/dsyr --- 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: missing_dependencies - 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 --- --- .../@stdlib/blas/base/dsyr/benchmark/c/benchmark.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c index 6d4e4da76475..2d81bf3830f6 100644 --- a/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c @@ -88,11 +88,13 @@ static double tic( void ) { */ static double benchmark1( int iterations, int N ) { double elapsed; - double A[ N*N ]; - double x[ N ]; + double *A; + double *x; double t; int i; + x = (double *)malloc( N * sizeof( double ) ); + A = (double *)malloc( N * N * sizeof( double ) ); stdlib_strided_dfill( N, 1.0, x, 1 ); stdlib_strided_dfill( N*N, 1.0, A, 1 ); t = tic(); @@ -119,11 +121,13 @@ static double benchmark1( int iterations, int N ) { */ static double benchmark2( int iterations, int N ) { double elapsed; - double A[ N*N ]; - double x[ N ]; + double *A; + double *x; double t; int i; + x = (double *)malloc( N * sizeof( double ) ); + A = (double *)malloc( N * N * sizeof( double ) ); stdlib_strided_dfill( N, 1.0, x, 1 ); stdlib_strided_dfill( N*N, 1.0, A, 1 ); t = tic(); @@ -138,6 +142,8 @@ static double benchmark2( int iterations, int N ) { if ( A[ i%(N*2) ] != A[ i%(N*2) ] ) { printf( "should not return NaN\n" ); } + free( x ); + free( A ); return elapsed; } From 30bb043478a46cb5d74a4519e16ededb95bca0b3 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 18 Dec 2025 17:11:56 -0800 Subject: [PATCH 2/2] bench: free allocated memory Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c index 2d81bf3830f6..9b5d3b2b039c 100644 --- a/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c @@ -109,6 +109,8 @@ static double benchmark1( int iterations, int N ) { if ( A[ i%(N*2) ] != A[ i%(N*2) ] ) { printf( "should not return NaN\n" ); } + free( x ); + free( A ); return elapsed; }