File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ describe('binary', () => {
52
52
return Streamer
53
53
}
54
54
55
+ const snapshotBufferMemoryUsage = function ( ) {
56
+ const mu = process . memoryUsage ( )
57
+ const mem = mu . arrayBuffers || mu . external
58
+ return mem / 1024 / 1024
59
+ }
60
+
55
61
it ( 'low copy-to memory usage during large bytea streaming' , ( done ) => {
56
62
const power = 26
57
63
const sql = "COPY (select (repeat('-', CAST(2^" + power + ' AS int)))::bytea) TO STDOUT BINARY'
@@ -63,7 +69,7 @@ describe('binary', () => {
63
69
write ( chunk , enc , cb ) {
64
70
if ( Math . random ( ) < 0.02 ) {
65
71
global . gc ( )
66
- const memNow = process . memoryUsage ( ) . external / 1024 / 1024
72
+ const memNow = snapshotBufferMemoryUsage ( )
67
73
try {
68
74
const memLimit = 32 /*MB*/
69
75
const memDiff = Math . abs ( memNow - memStart )
@@ -89,7 +95,7 @@ describe('binary', () => {
89
95
} )
90
96
91
97
global . gc ( true )
92
- const memStart = process . memoryUsage ( ) . external / 1024 / 1024
98
+ const memStart = snapshotBufferMemoryUsage ( )
93
99
const stream = client . query ( query ) . pipe ( lfs ) . pipe ( noop )
94
100
95
101
stream . on ( 'error' , ( err ) => {
You can’t perform that action at this time.
0 commit comments