Skip to content

Commit 0e9fa94

Browse files
bench: refactor to use dynamic memory allocation in blas/ext/base/dapxsumpw
PR-URL: #10607 Ref: #8643 Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
1 parent 727913e commit 0e9fa94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/node_modules/@stdlib/blas/ext/base/dapxsumpw/benchmark/c/benchmark.length.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,12 @@ static double benchmark1( int iterations, int len ) {
132132
*/
133133
static double benchmark2( int iterations, int len ) {
134134
double elapsed;
135-
double x[ len ];
135+
double *x;
136136
double v;
137137
double t;
138138
int i;
139139

140+
x = (double *) malloc( len * sizeof( double ) );
140141
for ( i = 0; i < len; i++ ) {
141142
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
142143
}
@@ -154,6 +155,7 @@ static double benchmark2( int iterations, int len ) {
154155
if ( v != v ) {
155156
printf( "should not return NaN\n" );
156157
}
158+
free( x );
157159
return elapsed;
158160
}
159161

0 commit comments

Comments
 (0)