Struct executorch_sys::torch::executor::MemoryAllocator
source · #[repr(C, align(8))]pub struct MemoryAllocator {
pub _bindgen_opaque_blob: [u64; 5],
}Expand description
A class that does simple allocation based on a size and returns the pointer to the memory address. It bookmarks a buffer with certain size. The allocation is simply checking space and growing the cur_ pointer with each allocation request.
Simple example:
// User allocates a 100 byte long memory in the heap. uint8_t* memory_pool = malloc(100 * sizeof(uint8_t)); MemoryAllocator allocator(100, memory_pool) // Pass allocator object in the Executor
Underneath the hood, ExecuTorch will call allocator.allocate() to keep iterating cur_ pointer
Fields§
§_bindgen_opaque_blob: [u64; 5]Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryAllocator
impl RefUnwindSafe for MemoryAllocator
impl Send for MemoryAllocator
impl Sync for MemoryAllocator
impl Unpin for MemoryAllocator
impl UnwindSafe for MemoryAllocator
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