test: check gc does not resurrect the loop

PR-URL: https://github.com/nodejs/node/pull/21093
Fixes: https://github.com/nodejs/node/issues/18190
Refs: https://github.com/nodejs/node/pull/18307
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Anatoli Papirovski 2018-06-06 16:06:51 -04:00
parent 9788da962e
commit ff16545f60
No known key found for this signature in database
GPG Key ID: 614E2E1ABEB4B2C0

View File

@ -1,4 +1,5 @@
'use strict';
// Flags: --expose-gc
const common = require('../common');
const assert = require('assert');
@ -22,6 +23,11 @@ common.crashOnUnhandledRejection();
},
}).enable();
process.on('beforeExit', common.mustCall(() => {
// This garbage collection call verifies that the wraps being garbage
// collected doesn't resurrect the process again due to weirdly timed
// uv_close calls and other similar instruments in destructors.
global.gc();
process.removeAllListeners('uncaughtException');
hooks.disable();
delete providers.NONE; // Should never be used.