2 ms·
> You're right in that things won't work if something else > has a ptr to these pages. That's the problem, exactly. In a browser context it's pretty easy for
by bzbarsky 15y ago
> You're right in that things won't work if something else
> has a ptr to these pages.
That's the problem, exactly. In a browser context it's pretty easy for something else (another frame, a web page in another tab or window) to have pointers into the DOM of pages that have been navigated away from. So when a page is evicted from the in-memory cache some of the information can just be destroyed. The layout objects, say. These are already allocated out of an arena, so the mmap approach may work there; it's worth looking into. But the DOM can't just be unmapped (and in fact is not arena-allocated for the same reason right now) unless you're willing to pin the whole mmaped area if something holds on to those objects, which brings us back to fragmentation issues.