std :: alloc::tlsf
Struct std::TlsfAllocator
struct TlsfAllocator {
&heap unsigned char base;
int owned;
unsigned long cap;
unsigned int fl_bitmap;
unsigned int sl_bitmap[TLSF_FL_MAX];
?&TlsfBlock blocks[TLSF_FL_MAX * TLSF_SL_COUNT];
}Fields
heap-backed managed memory
1 if TlsfAllocator::new allocated base (destroy() frees it)
first-level bitmap
second-level bitmaps
free-list heads
Methods
A TLSF allocator over a user-provided heap buffer of cap bytes.
A heap-backed TLSF allocator of cap bytes.
Allocate size bytes aligned to align. O(1). Every block is
8-aligned (given an 8-aligned buffer: always for TlsfAllocator::new), so align
is honoured up to 8 (0 is taken as 1). null when no free block fits,
or align is above 8 or not a power of two.
Free a previously allocated pointer (null: no-op). O(1). Aborts with a diagnostic on a double free.
Free every block at once: the whole buffer is one free block again (blocks handed out before become invalid). O(1) in the block count.
Free the backing buffer (only valid for heap-backed allocators).
= drop()