File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,13 @@ function isZeroFilled(buf) {
1414 return true ;
1515}
1616
17+ // We have to consume the data from the pool as otherwise
18+ // we would be testing what's in snapshot, which is zero-filled
19+ // regardless of the flag presence, and we want to test the flag
20+ for ( let i = 0 ; i < 8 ; i ++ ) {
21+ assert ( isZeroFilled ( Buffer . allocUnsafe ( 1024 ) ) ) ;
22+ }
23+
1724// This can be somewhat unreliable because the
1825// allocated memory might just already happen to
1926// contain all zeroes. The test is run multiple
@@ -22,7 +29,8 @@ for (let i = 0; i < 50; i++) {
2229 const bufs = [
2330 Buffer . alloc ( 20 ) ,
2431 Buffer . allocUnsafe ( 20 ) ,
25- Buffer . allocUnsafeSlow ( 20 ) ,
32+ Buffer . allocUnsafeSlow ( 20 ) , // Heap
33+ Buffer . allocUnsafeSlow ( 128 ) , // Alloc
2634 Buffer ( 20 ) ,
2735 ] ;
2836 for ( const buf of bufs ) {
You can’t perform that action at this time.
0 commit comments