pub struct StaticDlmallocAllocator<T> { /* private fields */ }
Implementations§
Source§impl<T> StaticDlmallocAllocator<T>
impl<T> StaticDlmallocAllocator<T>
Trait Implementations§
Source§impl<T: GetStaticHeapBounds + Send> Allocator for StaticDlmallocAllocator<T>
impl<T: GetStaticHeapBounds + Send> Allocator for StaticDlmallocAllocator<T>
Source§fn alloc(&self, size: usize) -> (*mut u8, usize, u32)
fn alloc(&self, size: usize) -> (*mut u8, usize, u32)
Allocates system memory region of at least
size
bytes
Returns a triple of (base, size, flags)
where base
is a pointer to the beginning of the
allocated memory region. size
is the actual size of the region while flags
specifies
properties of the allocated region. If EXTERN_BIT
(bit 0) set in flags, then we did not
allocate this segment and so should not try to deallocate or merge with others.
This function can return a std::ptr::null_mut()
when allocation fails (other values of
the triple will be ignored).Source§fn remap(
&self,
_ptr: *mut u8,
_oldsize: usize,
_newsize: usize,
_can_move: bool,
) -> *mut u8
fn remap( &self, _ptr: *mut u8, _oldsize: usize, _newsize: usize, _can_move: bool, ) -> *mut u8
Remaps system memory region at
ptr
with size oldsize
to a potential new location with
size newsize
. can_move
indicates if the location is allowed to move to a completely new
location, or that it is only allowed to change in size. Returns a pointer to the new
location in memory.
This function can return a std::ptr::null_mut()
to signal an error.Source§fn free_part(&self, _ptr: *mut u8, _oldsize: usize, _newsize: usize) -> bool
fn free_part(&self, _ptr: *mut u8, _oldsize: usize, _newsize: usize) -> bool
Frees a part of a memory chunk. The original memory chunk starts at
ptr
with size oldsize
and is turned into a memory region starting at the same address but with newsize
bytes.
Returns true
iff the access memory region could be freed.Source§fn free(&self, _ptr: *mut u8, _size: usize) -> bool
fn free(&self, _ptr: *mut u8, _size: usize) -> bool
Frees an entire memory region. Returns
true
iff the operation succeeded. When false
is
returned, the dlmalloc
may re-use the location on future allocation requestsSource§fn can_release_part(&self, _flags: u32) -> bool
fn can_release_part(&self, _flags: u32) -> bool
Indicates if the system can release a part of memory. For the
flags
argument, see
Allocator::alloc
Source§fn allocates_zeros(&self) -> bool
fn allocates_zeros(&self) -> bool
Indicates whether newly allocated regions contain zeros.