Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created July 21, 2020 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcrichton/5eb392f514bad5142df90f376a4e8654 to your computer and use it in GitHub Desktop.
Save alexcrichton/5eb392f514bad5142df90f376a4e8654 to your computer and use it in GitHub Desktop.
const a = new FinalizationRegistry(v => {
console.log('a');
console.log('b', v);
for (const val in v) {
console.log(val);
}
});
function f() {
const obj = {a: 3};
a.register(obj, { b: 3});
}
f();
console.log('before gc');
global.gc();
console.log('after gc');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment