pub struct Allocator { /* private fields */ }Expand description
An Allocator for arcon.
The allocator is not meant to handle all heap allocations during the execution. However, it is intended to be used to manage memory for different sections of the runtime. This includes message buffers, network buffers, and state indexes.
Implementations§
Source§impl Allocator
impl Allocator
Sourcepub unsafe fn alloc<T>(&mut self, capacity: usize) -> AllocResult
pub unsafe fn alloc<T>(&mut self, capacity: usize) -> AllocResult
Allocate memory block of type T with given capacity
§Safety
It is up to the caller to ensure dealloc with the generated AllocId
Sourcepub unsafe fn dealloc(&mut self, id: AllocId)
pub unsafe fn dealloc(&mut self, id: AllocId)
Deallocate memory through the given AllocId
§Safety
It is up to the caller to ensure that the given AllocId is active
Sourcepub fn allocated_bytes(&self) -> usize
pub fn allocated_bytes(&self) -> usize
Returns amount of bytes that are currently allocated
Sourcepub fn total_allocations(&self) -> u128
pub fn total_allocations(&self) -> u128
Returns total allocations made so far
Sourcepub fn bytes_remaining(&self) -> usize
pub fn bytes_remaining(&self) -> usize
Returns how much bytes are available to allocate
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Allocator
impl RefUnwindSafe for Allocator
impl !Sync for Allocator
impl Unpin for Allocator
impl UnwindSafe for Allocator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more