
Ask HN: Any good resource on writing your own mmap allocator? - cplat
I&#x27;ve been experimenting with using mmapped files as storage. One thing that I&#x27;m trying out is writing variable sized records to an mmapped file. However, I&#x27;ll also be supporting deletions and updates, so fragmentation can become a big problem. Moreover, there could be records written at different times that need to be physically &quot;colocated&quot; for efficiency.<p>My question is, are there good resources to get started on working on on-disk allocators? I don&#x27;t want to get there in a day, but need a solid direction. Thanks!
======
rain1
I collected some links to interesting and useful links about allocators here
[https://github.com/rain-1/awesome-
allocators](https://github.com/rain-1/awesome-allocators)

I think you would look into bitmap based allocators (which only handles fixed
size allocations, but it's very simple) and then (more advanced) binary
buddies system to start with.

* [http://sean.cm/a/tricolor-garbage-collector](http://sean.cm/a/tricolor-garbage-collector)

* [http://www.memorymanagement.org/mmref/alloc.html](http://www.memorymanagement.org/mmref/alloc.html)

~~~
cplat
Thanks! This is very useful.

