fkymy / mpool

A simple memory allocation pool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

                 mpool : A Memory Allocation Pool

mpool is a simple memory allocation pool. It speeds up programs that
needs many system calls for allocating small memory blocks. For example,
it is useful for large tree structures that requires making a system
call with malloc each time a new node is added.

It also allows semi-automatic memory management. There is no need to
traverse your complex data structure to free all of its memory, since
the memory blocks are separately managed by mpool.

mpool works by creating a subpool with a large chunk of memory block,
which is given out in smaller chunks as requested. When a request exceeds
the size of a subpool (a miss), it creates a new subpool twice the size
of the previous subpool. A subpool with too many misses is no longer
used for subsequent requests.

There is thread safety option, but it is not recommended.


About

A simple memory allocation pool


Languages

Language:C 96.0%Language:Makefile 4.0%