2 ms·
> I have spent more time learning about how Chrome's garbage collection works than I would have ever spent manually tracking references myself. Do you have any
by lylecubed 8y ago
> I have spent more time learning about how Chrome's garbage collection works than I would have ever spent manually tracking references myself.
Do you have any good references you can share regarding Chrome's garbage collection? This is a topic I would like to learn more about.
- danShumway 8y agoUnfortunately not - there are probably good resources out there, but most of what I know has come out of manual profiling in Chrome, different experiments, and the occasional StackOverflow post that explains a weird behavior or two. At some point in the future I will probably write a blog post about good techniques for taking back control of JS memory management from the browser, but it probably won't be for a while. The short answer though is that browsers try to defer garbage collection until it looks like the page isn't doing much; and the problem is that games don't ever really stop doing stuff. This encourages the browser to put off garbage collection and handle it in chunks, which in turn leads to dropped frames because you're doing a lot of deallocation at once. This is why if you profile a Chrome app that's doing a lot of allocations very quickly, your memory usage will kind of sawtooth all over the place. And you get around that by getting rid of as many allocations as possible. IMO the lack of garbage collection in WASM is the most exciting thing about it, but different languages have different tradeoffs and WASM isn't appropriate for every application.