Skip to content

Commit 82bc0ec

Browse files
bench: refactor to use dynamic memory allocation in blas/ext/base/dapxsumpw
PR-URL: #9047 Ref: #8643 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 028d3db commit 82bc0ec

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
@@ -96,11 +96,12 @@ static double rand_double( void ) {
9696
*/
9797
static double benchmark1( int iterations, int len ) {
9898
double elapsed;
99-
double x[ len ];
99+
double *x;
100100
double v;
101101
double t;
102102
int i;
103103

104+
x = (double *) malloc( len * sizeof( double ) );
104105
for ( i = 0; i < len; i++ ) {
105106
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
106107
}
@@ -118,6 +119,7 @@ static double benchmark1( int iterations, int len ) {
118119
if ( v != v ) {
119120
printf( "should not return NaN\n" );
120121
}
122+
free( x );
121123
return elapsed;
122124
}
123125

0 commit comments

Comments
 (0)