Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by lfy_google on Sunday January 06, 2019 @04:01PM
(#18840687)
https://android.googlesource.com/platform/external/qemu/+/em...
https://android.googlesource.com/platform/external/qemu/+/em...
https://android.googlesource.com/platform/external/qemu/+/em...
These 3 files should be a fairly self contained, minimal way to allocate into existing buffers. No attempt is made at thread safety though (we assume the user synchronizes that themselves)
Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by dividuum on Sunday January 06, 2019 @05:19PM
(#18841112)
This TLSF implementation should be able to do that: https://github.com/mattconte/tlsf
Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by nuclx on Sunday January 06, 2019 @11:32PM
(#18842765)
FreeRTOS features sone nice and simple allocators on fixed buffers [0].
I have used heap4 to implement memory management for a fully portable test suite requiring malloc. Really any toy allocator would have done the job for that use-case, since performance wasn't critical, but heap4 was fairly easy to integrate.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by davidtgoldblatt on Sunday January 06, 2019 @10:17PM
(#18842497)
Depending on what exactly you mean by "hand it a block of memory to manage", you can do this with jemalloc's extent hook functionality. Though that's meant for "I have some long-lived data structures, I want all their memory stored on hugepages" more than "I have this small-ish data structure, I want to batch its allocations together".
Something like
would be nice. :-)[0] https://medium.com/iskakaushik/eli5-jemalloc-e9bd412abd70