For memory allocation you often don&#x27;t need to use malloc. Many (most?) programs can mmap a large region of memory and allocate from that. Then when you&#x27;re done you just unmap the region. This is much easier to use since you only have to remember to unmap once as opposed to handling each allocated pointer individually.<p>Edit: Here is a paper that touches a bit on what I&#x27;m describing: <a href="http:&#x2F;&#x2F;people.cs.umass.edu&#x2F;~emery&#x2F;pubs&#x2F;berger-oopsla2002.pdf" rel="nofollow">http:&#x2F;&#x2F;people.cs.umass.edu&#x2F;~emery&#x2F;pubs&#x2F;berger-oopsla2002.pdf</a><p>Also, to clarify, I&#x27;m not saying allocate yourself a big piece of memory and then reimplement malloc on top of that. You literally just get a big piece of memory and every time you want to allocate something new from it add the offset to the base address, return that to the user, and store the new offset.