Me, Surma, and Jason were hacking on a thing, and discovered that garbage collection within a function doesn't quite work how we expected. function demo() { const bigArrayBuffer = new ArrayBuffer(100_000_000); const id = setTimeout(() => { console.log(bigArrayBuffer.byteLength); }, 1000); return () => clearTimeout(id); } globalThis.cancelDemo = demo(); With the above, bigArrayBuffer is leaked fore
![Garbage collection and closures](https://cdn-ak-scissors.b.st-hatena.com/image/square/0db3ba300c6e531918df08d9f10c79d9cb768271/height=288;version=1;width=512/https%3A%2F%2Fjakearchibald.com%2Fc%2Fimg-03ff11c9.png)