[TUHS] Memory management in Dennis Ritchie's C Compiler
velocityboy at gmail.com
Tue Aug 18 05:35:47 AEST 2020
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 at gmail.com>
> On 8/17/20, Jim Geist <velocityboy at 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
> > 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the TUHS