[riot-notifications] [RIOT-OS/RIOT] [WIP] Generic memory block allocator (#7651)
notifications at github.com
Wed Sep 27 19:45:40 CEST 2017
This PR adds a generic block allocator, allowing "dynamic" allocations of structures of the same size in a static memory pool.
It is meant to replace malloc in cases where only fixed size blocks are allocated and freed (see #7615).
### Example usage
// Initialize static memory pool "mem" which can hold 3 somestruct_t
MEMARRAY(mem, somestruct_t, 3);
// Initialize mem as a linked list of free elements
// Allocate structure
mem = memarray_alloc(&mem);
// Do whatever needs to be done
// Free struct
### Work in Progress
Things to be done:
- Add documentation
- Add unittests
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* sys/memarray: added generic memory block allocator module
-- File Changes --
M sys/Makefile (3)
A sys/include/memarray.h (55)
A sys/memarray/Makefile (1)
A sys/memarray/memarray.c (39)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications