Memory allocator for embedded systems
This is a small memory allocator I wrote when debugging memory allocation problems on an embedded system. The allocator works with fixed size blocks, which leads to lower overhead than using linked lists allowing for arbitrarily sized allocations but it will waste some memory. The blocksize can be configured.
The information about used blocks is stored in a bitmap and the allocator tries reducing fragmentation. All reserved memory blocks are secured with a special fence pattern at the end of requested size. If the application overwrites the fence bytes the allocator will notice this when calling free for that region.
Although it's called TCPGW Allocator for "THAT CAN'T POSSIBLY GO WRONG allocator" it hasn't been tested all that extensively, so be careful as it might still go wrong in very horrible ways despite the name :)
TCPGW Alloc is Public Domain so there are no restricitons using it. However if you improve it or fix bugs, I'd like to hear from you. You can contact me via sebastian@frozenlight.de.
Get the TCPGW allocator
Back