pub struct MemoryCompactor { /* private fields */ }Expand description
Memory compaction manager
Implementations§
Source§impl MemoryCompactor
impl MemoryCompactor
Sourcepub fn new(
device: Arc<Device>,
queue: Arc<Queue>,
config: CompactionConfig,
) -> Self
pub fn new( device: Arc<Device>, queue: Arc<Queue>, config: CompactionConfig, ) -> Self
Create a new memory compactor
Sourcepub fn register_allocation(&self, id: u64, offset: u64, size: u64, active: bool)
pub fn register_allocation(&self, id: u64, offset: u64, size: u64, active: bool)
Register an allocation
Sourcepub fn unregister_allocation(&self, id: u64)
pub fn unregister_allocation(&self, id: u64)
Unregister an allocation
Sourcepub fn detect_fragmentation(&self) -> FragmentationInfo
pub fn detect_fragmentation(&self) -> FragmentationInfo
Detect fragmentation
Sourcepub fn needs_compaction(&self) -> bool
pub fn needs_compaction(&self) -> bool
Check if compaction is needed
Sourcepub async fn compact(&self) -> Result<CompactionResult>
pub async fn compact(&self) -> Result<CompactionResult>
Perform memory compaction
Sourcepub fn get_stats(&self) -> CompactionStats
pub fn get_stats(&self) -> CompactionStats
Get compaction statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics
Auto Trait Implementations§
impl Freeze for MemoryCompactor
impl !RefUnwindSafe for MemoryCompactor
impl Send for MemoryCompactor
impl Sync for MemoryCompactor
impl Unpin for MemoryCompactor
impl UnsafeUnpin for MemoryCompactor
impl !UnwindSafe for MemoryCompactor
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