• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Flags: --expose-gc
2'use strict';
3
4// Regression test for https://github.com/nodejs/node/issues/17475
5// Unfortunately, this tests only "works" reliably when checked with valgrind or
6// a similar tool.
7
8const common = require('../common');
9if (!common.hasCrypto)
10  common.skip('missing crypto');
11
12const { TLSSocket } = require('tls');
13const makeDuplexPair = require('../common/duplexpair');
14
15let { clientSide } = makeDuplexPair();
16
17let clientTLS = new TLSSocket(clientSide, { isServer: false });
18let clientTLSHandle = clientTLS._handle;  // eslint-disable-line no-unused-vars
19
20setImmediate(() => {
21  clientTLS = null;
22  global.gc();
23  clientTLSHandle = null;
24  global.gc();
25  setImmediate(() => {
26    clientSide = null;
27    global.gc();
28  });
29});
30