Struct xalloc::tlsf::Tlsf
[−]
[src]
pub struct Tlsf<T, A, P> where
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug, { /* fields omitted */ }
TLSF-based external memory allocator.
See the module-level documentation for more.
Type parameters
T
is an integer type used to represent region sizes. You usually useu32
oru64
for this.A
is a memory arena type used to allocate internal block structures.
Methods
impl<T, P, A> Tlsf<T, A, P> where
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
fn with_arena(size: T, arena: A) -> Self
[src]
Construct a Tlsf
.
fn arena(&self) -> &A
[src]
Get a reference to the underlying memory arena.
fn arena_mut(&mut self) -> &mut A
[src]
Get a mutable reference to the underlying memory arena.
fn alloc_aligned(&mut self, size: T, align: T) -> Option<(TlsfRegion<P>, T)>
[src]
Allocate a region of the size size
with a given alignment requirement.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
align
must be a power of two.size
must not be zero.
fn alloc(&mut self, size: T) -> Option<(TlsfRegion<P>, T)>
[src]
Allocate a region of the size size
.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
size
must not be zero.
unsafe fn dealloc_unchecked(&mut self, r: TlsfRegion<P>)
[src]
Deallocate the specified region, without checking the origin of the
TlsfRegion
.
This might result in an undefined behavior if r
originates from
a different instance of Tlsf
.
impl<T, P, A> Tlsf<T, A, P> where
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + UnsafeArenaWithMembershipCheck<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + UnsafeArenaWithMembershipCheck<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
fn dealloc(&mut self, r: TlsfRegion<P>) -> Result<(), TlsfRegion<P>>
[src]
Deallocate the specified region.
Returns Err(r)
if r
does not originate from the same instance of Tlsf
.
impl<T, P, A> Tlsf<T, A, P> where
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + SafeArena<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + SafeArena<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
fn dealloc_relaxed(&mut self, r: TlsfRegion<P>)
[src]
Deallocate the specified region.
r
must originate from the same instance of Tlsf
. Otherwise, Tlsf
enters an inconsistent state and possibly panics, but does not cause an
undefined behavior.
Trait Implementations
impl<T: Debug, A: Debug, P: Debug> Debug for Tlsf<T, A, P> where
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,