mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
05cb16dc1a
Always use `process.config.variables.asan`. This removes the need for a special ASAN env var. PR-URL: https://github.com/nodejs/node/pull/52430 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
30 lines
897 B
JavaScript
30 lines
897 B
JavaScript
// Flags: --expose-gc --noconcurrent_recompilation
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
if (common.isASan)
|
|
common.skip('ASan messes with memory measurements');
|
|
|
|
const assert = require('assert');
|
|
const crypto = require('crypto');
|
|
|
|
const before = process.memoryUsage.rss();
|
|
{
|
|
const size = common.hasFipsCrypto || common.hasOpenSSL3 ? 1024 : 256;
|
|
const dh = crypto.createDiffieHellman(size);
|
|
const publicKey = dh.generateKeys();
|
|
const privateKey = dh.getPrivateKey();
|
|
for (let i = 0; i < 5e4; i += 1) {
|
|
dh.setPublicKey(publicKey);
|
|
dh.setPrivateKey(privateKey);
|
|
}
|
|
}
|
|
global.gc();
|
|
const after = process.memoryUsage.rss();
|
|
|
|
// RSS should stay the same, ceteris paribus, but allow for
|
|
// some slop because V8 mallocs memory during execution.
|
|
assert(after - before < 10 << 21, `before=${before} after=${after}`);
|