Skip to content

Commit 9feee1f

Browse files
refackrvagg
authored andcommitted
test: call gc() explicitly to avoid OOM
PR-URL: #22301 Refs: nodejs/reliability#12 Refs: #16354 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
1 parent a562729 commit 9feee1f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --expose-gc
12
'use strict';
23

34
constcommon=require('../../common');
@@ -35,10 +36,13 @@ common.expectsError(function(){
3536
type: Error
3637
});
3738

39+
// FIXME: Free the memory early to avoid OOM.
40+
// REF: https://github.com/nodejs/reliability/issues/12#issuecomment-412619655
41+
global.gc();
3842
letmaxString=buf.toString('latin1',1);
3943
assert.strictEqual(maxString.length,kStringMaxLength);
40-
// Free the memory early instead of at the end of the next assignment
4144
maxString=undefined;
45+
global.gc();
4246

4347
maxString=buf.toString('latin1',0,kStringMaxLength);
4448
assert.strictEqual(maxString.length,kStringMaxLength);

0 commit comments

Comments
(0)