1// Flags: --expose-gc 2 3'use strict'; 4const common = require('../common'); 5if (!common.hasCrypto) 6 common.skip('missing crypto'); 7const http2 = require('http2'); 8const makeDuplexPair = require('../common/duplexpair'); 9const tick = require('../common/tick'); 10 11// This tests that running garbage collection while an Http2Session has 12// a write *scheduled*, it will survive that garbage collection. 13 14{ 15 // This creates a session and schedules a write (for the settings frame). 16 let client = http2.connect('http://localhost:80', { 17 createConnection: common.mustCall(() => makeDuplexPair().clientSide) 18 }); 19 20 // First, wait for any nextTicks() and their responses 21 // from the `connect()` call to run. 22 tick(10, () => { 23 // This schedules a write. 24 client.settings(http2.getDefaultSettings()); 25 client = null; 26 global.gc(); 27 }); 28} 29