V8 Garbage Collector

https://news.ycombinator.com/rss Hits: 7
Summary

Let鈥檚 talk about memory management! Following up on my article about 5 years of developments in V8鈥檚 garbage collector, today I鈥檇 like to bring that up to date with what went down in V8鈥檚 GC over the last couple years.methodololologyI selected all of the commits to src/heap since my previous roundup. There were 1600 of them, including reverts and relands. I read all of the commit logs, some of the changes, some of the linked bugs, and any design document I could get my hands on. From what I can tell, there have been about 4 FTE from Google over this period, and the commit rate is fairly constant. There are very occasional patches from Igalia, Cloudflare, Intel, and Red Hat, but it鈥檚 mostly a Google affair.Then, by the very rigorous process of, um, just writing things down and thinking about it, I see three big stories for V8鈥檚 GC over this time, and I鈥檓 going to give them to you with some made-up numbers for how much of the effort was spent on them. Firstly, the effort to improve memory safety via the sandbox: this is around 20% of the time. Secondly, the Oilpan odyssey: maybe 40%. Third, preparation for multiple JavaScript and WebAssembly mutator threads: 20%. Then there are a number of lesser side quests: heuristics wrangling (10%!!!!), and a long list of miscellanea. Let鈥檚 take a deeper look at each of these in turn.the sandboxThere was a nice blog post in June last year summarizing the sandbox effort: basically, the goal is to prevent user-controlled writes from corrupting memory outside the JavaScript heap. We start from the assumption that the user is somehow able to obtain a write-anywhere primitive, and we work to mitigate the effect of such writes. The most fundamental way is to reduce the range of addressable memory, notably by encoding pointers as 32-bit offsets and then ensuring that no host memory is within the addressable virtual memory that an attacker can write. The sandbox also uses some 40-bit offsets for references to larger objects, with similar ...

First seen: 2025-11-14 10:51

Last seen: 2025-11-14 16:52