Efficient pool allocator C?

I'm currently trying to write a 2D scene graph in C and I need to decide how to save the child nodes. I expect a lot of readings and writes a little, so the linked list is out of the question due to the poor spatial locality of the link, and using realloc every time to add a child node, it may fragment the free list into oblivion, Pool allocator, by seems to be the best solution, but I cannot find any implementations to use. Does anyone know of a distributor that would efficiently handle random distributions and releases from hundreds of small struct s, or perhaps a better distribution scheme?

+6
c memory-management arrays dynamic
source share
2 answers

I am ready to deploy TLSF as a real-time distributor. I have not yet had the opportunity to profile its performance, but it seems to work, and the license is correct.

In accordance with their documents, its operations perform "a maximum of 168 processor instructions in the x86 architecture." It comes as a single .c file, which compiled without modification on my system.

+4
source share

Take a look at halloc, maybe this will help.

http://swapped.cc/halloc/

+2
source share

All Articles