True, but zones and HeapAlloc do a fair bit of work to handle objects of
multiple sizes. If you're partitioning up a page and you know every object
on the page is 8 or 16 or 48 bytes, it's MUCH simpler. And a lot of the
data structures in a compiler tend to be small-tens-of-bytes nodes.
On Mon, Aug 17, 2020 at 3:28 PM Paul Winalski <paul.winalski(a)gmail.com>
wrote:
On 8/17/20, Jim Geist <velocityboy(a)gmail.com>
wrote:
When did mmap(2) come about? Another thing
I've seen is building a small
block allocator on top of that. You can guarantee that all your objects
are
nicely collected into the same set of pages for
locality with very little
overhead.
mmap(2) certainly can be used to allocate blocks for the mini-heap
itself, but you still have to write your own equivalents of malloc()
and free() to allocate data structures within the mini-heap. The nice
thing about VMS heap zones and Microsoft's private heaps is that you
get the malloc()/free() layer off-the-shelf; you don't have to roll
your own.
-Paul W.