#
80387c4e |
|
23-Sep-2016 |
John Grossman <johngro@google.com> |
[utils] Add a region allocator utility library. Add a small utility library (and tests) to manage allocating regions of a 64-bit space. The general idea is that a user of the library can create an allocator and add some (non-overlapping) regions to it. They can then allocate regions from the available regions in the allocator, either by size and alignment requirement or by specific base address and size. C and C++ APIs are provided. The C++ API depends on mxtl, but does not depend on any particular implementation of new. Instead, it explicitly uses malloc/free under the hood. Bookkeeping allocation is done using allocation pools which allocate and carve up slabs of memory (placing the results on a free list) in order to minimize the frequency of trips to the heap and avoid heap fragmentation. Limits can be placed on the total size of a pool, and pools can be shared across multiple allocators allowing multiple applications in the same binary to compartmentalize their memory impact. Change-Id: I007322b66f60c2e520e45013e9c3352a60557af0
|