summaryrefslogtreecommitdiff
path: root/test/addons/stringbytes-external-exceed-max
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2018-08-13 16:18:40 -0400
committerRefael Ackermann <refack@gmail.com>2018-08-14 02:27:32 -0400
commit4ce744a24b52659dc3b365a32fddcc1b92fd67c0 (patch)
treee019c3a0be68b12268ea60271c59314a311a8781 /test/addons/stringbytes-external-exceed-max
parentc75c917823ac49abbe99d847d20b1fe93e9872a7 (diff)
downloadandroid-node-v8-4ce744a24b52659dc3b365a32fddcc1b92fd67c0.tar.gz
android-node-v8-4ce744a24b52659dc3b365a32fddcc1b92fd67c0.tar.bz2
android-node-v8-4ce744a24b52659dc3b365a32fddcc1b92fd67c0.zip
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/addons/stringbytes-external-exceed-max')
-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 f8aed7c0b2..e4edd32797 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');
@@ -35,10 +36,13 @@ common.expectsError(function() {
type: Error
});
+// 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);