This is a working memory allocator for C++!
It was written as test code for an operating systems class project, we were implementing a virtual memroy system, and so I built an allocator on top of that.
To work, it needs access to a vm_map
call which will return a fresh 4KB page, and it needs to return consecutive addresses for consecutive calls (at least most of the time, or else we can't allocate large blocks).
It is based on a linear search through a free list, with a best-fit allocation scheme.