I don&#x27;t understand how this could lead to a security hole any more easily than using malloc could. Can you give an example? The system memory allocator is using mmap internally anyways (on Linux and anywhere else using the Doug Lea allocator at least) and a simple region based allocator is only a couple dozen lines of code.<p>The semantics are simple as well:<p><pre><code>    region create_region(size_t size);
    void * allocate(region *r, size_t size);
    void destroy_region(region *r);
</code></pre>
Edit: also, you&#x27;re not reinventing malloc for no good reason. A region based allocator is much faster, possibly at the expense of using more space than the system allocator (because you might reserve more space than you actually need).