pub struct SparseMemoryPool { /* private fields */ }Expand description
Sparse memory pool for efficient memory management
Implementations§
Source§impl SparseMemoryPool
impl SparseMemoryPool
Sourcepub fn with_config(config: MemoryPoolConfig) -> Self
pub fn with_config(config: MemoryPoolConfig) -> Self
Create a new memory pool with custom configuration
Sourcepub fn allocate(
&mut self,
size: usize,
allocation_type: &str,
) -> TorshResult<SparseMemoryHandle>
pub fn allocate( &mut self, size: usize, allocation_type: &str, ) -> TorshResult<SparseMemoryHandle>
Allocate memory for sparse matrix data
Sourcepub fn deallocate(&mut self, handle: SparseMemoryHandle)
pub fn deallocate(&mut self, handle: SparseMemoryHandle)
Deallocate memory back to the pool
Sourcepub fn garbage_collect(&mut self)
pub fn garbage_collect(&mut self)
Perform garbage collection
Sourcepub fn force_garbage_collect(&mut self)
pub fn force_garbage_collect(&mut self)
Force garbage collection (ignore timing restrictions)
Sourcepub fn statistics(&self) -> MemoryStatistics
pub fn statistics(&self) -> MemoryStatistics
Get current memory statistics
Sourcepub fn usage_by_type(&self) -> HashMap<String, usize>
pub fn usage_by_type(&self) -> HashMap<String, usize>
Get memory usage by allocation type
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if memory pool is healthy (not near capacity)
Sourcepub fn efficiency_score(&self) -> f64
pub fn efficiency_score(&self) -> f64
Get memory efficiency score (0.0 to 1.0)
Trait Implementations§
Source§impl Debug for SparseMemoryPool
impl Debug for SparseMemoryPool
Auto Trait Implementations§
impl Freeze for SparseMemoryPool
impl RefUnwindSafe for SparseMemoryPool
impl Send for SparseMemoryPool
impl Sync for SparseMemoryPool
impl Unpin for SparseMemoryPool
impl UnsafeUnpin for SparseMemoryPool
impl UnwindSafe for SparseMemoryPool
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more