Struct dlmalloc::Dlmalloc [−][src]
pub struct Dlmalloc<A = System>(_);
Expand description
An allocator instance
Instances of this type are used to allocate blocks of memory. For best
results only use one of these. Currently doesn’t implement Drop
to release
lingering memory back to the OS. That may happen eventually though!
Implementations
Creates a new instance of an allocator
Allocates size
bytes with align
align.
Returns a null pointer if allocation fails. Returns a valid pointer otherwise.
Safety and contracts are largely governed by the GlobalAlloc::alloc
method contracts.
Same as malloc
, except if the allocation succeeds it’s guaranteed to
point to size
bytes of zeros.
Deallocates a ptr
with size
and align
as the previous request used
to allocate it.
Safety and contracts are largely governed by the GlobalAlloc::dealloc
method contracts.
Reallocates ptr
, a previous allocation with old_size
and
old_align
, to have new_size
and the same alignment as before.
Returns a null pointer if the memory couldn’t be reallocated, but ptr
is still valid. Returns a valid pointer and frees ptr
if the request
is satisfied.
Safety and contracts are largely governed by the GlobalAlloc::realloc
method contracts.