Skip to content

Commit d58867a

Browse files
refackMylesBorins
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 f5985c7 commit d58867a

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

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

34
const common = require('../../common');
@@ -29,10 +30,13 @@ assert.throws(function() {
2930
buf.toString('latin1');
3031
}, /"toString\(\)" failed/);
3132

33+
// FIXME: Free the memory early to avoid OOM.
34+
// REF: https://github.com/nodejs/reliability/issues/12#issuecomment-412619655
35+
global.gc();
3236
let maxString = buf.toString('latin1', 1);
3337
assert.strictEqual(maxString.length, kStringMaxLength);
34-
// Free the memory early instead of at the end of the next assignment
3538
maxString = undefined;
39+
global.gc();
3640

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

0 commit comments

Comments
 (0)