[−][src]Crate redox_buffer_pool
redox-buffer-pool
This crate provides a buffer pool for general-purpose memory management, with support for allocating slices within the pool, as well as expanding the pool with potentially non-adjacent larger underlying memory allocations, like mmap(2) or other larger possible page-sized allocations.
The current allocator uses one B-trees to partition the space into regions either marked as occupied or free. The keys used by the B-tree have a custom comparator, which ensures that keys for used ranges are orderered after the keys for free ranges. This, together with having a free space tree, makes acquiring buffer slices possible in O(log n), provided that there is already an aligned range (otherwise, it simply does linear search in O(n) until it finds a range large enough to account for the misalignment).
Structs
BeginExpandError | The error internally caused by arithmetic overflow, that indicates the buffer pool has no more usable ranges. |
BufferPool | A buffer pool, featuring a general-purpose 32-bit allocator, and slice guards. |
BufferPoolOptions | Various options used by the buffer pool mainly to limit the range of possible sizes and alignments. |
BufferSlice | A slice from the buffer pool, that can be read from or written to as a regular smart pointer. |
CloseError | The error from |
ExpansionHandle | A handle for expansion. When this handle is retrieved by the |
MmapEntries | The iterator given to the close handle, or optionally retrieved by manually destroying a buffer pool, that contains all the underlying allocations that the pool has been expanded with. |
MmapEntry | The entry type from the |
ReclaimError | The potential error from |
WithGuardError | The potential error from |
Enums
AllocationStrategy | The strategy to use when allocating, with tradeoffs between heap fragmentation, and the algorithmic complexity of allocating. |
NoGuard | A no-op guard, that cannot be initialized but still useful in type contexts. This the recommended placeholder for types that do not need guarding. |
NoHandle | A handle type that cannot be initialized, causing the handle to take up no space in the buffer pool struct. |
Traits
AsBufferPool | A trait for types that are convertible by reference, into |
Guard | A trait for guards, that decide whether memory can be deallocated, or whether it may be shared with an actor outside of control from this process at all. |
Guardable | The base trait for types that are "guardable", meaning that they will leak on |
GuardableExclusive | A trait for guardable types, that are also non-aliasable (while there is a guard), and mutable.
This trait is intended to be implemented for any type of collection with exclusive access to
the inner data, e.g. |
GuardableShared | A trait for guardable types, that are aliasable and immutable. This trait is primarily focused
for types behaving like |
Handle | The requirement of a handle to be able to be passed into the buffer pool. |
Integer | A type that can be used as offsets and lengths within a buffer pool. The default integer is u32. |
Type Definitions
CloseResult | The result originating from |
WithGuardResult | The result originating from |