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>
This commit is contained in:
parent
c75c917823
commit
4ce744a24b
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user