11cb0ef41Sopenharmony_ci// Flags: --expose-gc 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci// Regression test for https://github.com/nodejs/node/issues/17475 51cb0ef41Sopenharmony_ci// Unfortunately, this tests only "works" reliably when checked with valgrind or 61cb0ef41Sopenharmony_ci// a similar tool. 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst common = require('../common'); 91cb0ef41Sopenharmony_ciif (!common.hasCrypto) 101cb0ef41Sopenharmony_ci common.skip('missing crypto'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciconst { TLSSocket } = require('tls'); 131cb0ef41Sopenharmony_ciconst makeDuplexPair = require('../common/duplexpair'); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_cilet { clientSide } = makeDuplexPair(); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cilet clientTLS = new TLSSocket(clientSide, { isServer: false }); 181cb0ef41Sopenharmony_cilet clientTLSHandle = clientTLS._handle; // eslint-disable-line no-unused-vars 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_cisetImmediate(() => { 211cb0ef41Sopenharmony_ci clientTLS = null; 221cb0ef41Sopenharmony_ci global.gc(); 231cb0ef41Sopenharmony_ci clientTLSHandle = null; 241cb0ef41Sopenharmony_ci global.gc(); 251cb0ef41Sopenharmony_ci setImmediate(() => { 261cb0ef41Sopenharmony_ci clientSide = null; 271cb0ef41Sopenharmony_ci global.gc(); 281cb0ef41Sopenharmony_ci }); 291cb0ef41Sopenharmony_ci}); 30