summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2018-08-13 16:18:40 -0400
committerMyles Borins <mylesborins@google.com>2018-09-25 22:24:07 -0400
commitd58867a6a7c9376fcbfecd94f96d36af3c787f74 (patch)
tree1b6cfed61f05a3ef7005fa9bf5262c688f04de6f /test
parentf5985c734cf1072defc63a3b34cc37a299b7e391 (diff)
downloadnode-new-d58867a6a7c9376fcbfecd94f96d36af3c787f74.tar.gz
test: call gc() explicitly to avoid OOM
PR-URL: https://github.com/nodejs/node/pull/22301 Refs: https://github.com/nodejs/reliability/issues/12 Refs: https://github.com/nodejs/node/issues/16354 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'test')
-rw-r--r--test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js
index 996c01752d..844ebb45ba 100644
--- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js
+++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js
@@ -1,3 +1,4 @@
+// Flags: --expose-gc
'use strict';
const common = require('../../common');
@@ -29,10 +30,13 @@ assert.throws(function() {
buf.toString('latin1');
}, /"toString\(\)" failed/);
+// FIXME: Free the memory early to avoid OOM.
+// REF: https://github.com/nodejs/reliability/issues/12#issuecomment-412619655
+global.gc();
let maxString = buf.toString('latin1', 1);
assert.strictEqual(maxString.length, kStringMaxLength);
-// Free the memory early instead of at the end of the next assignment
maxString = undefined;
+global.gc();
maxString = buf.toString('latin1', 0, kStringMaxLength);
assert.strictEqual(maxString.length, kStringMaxLength);