Skip to main content

GlobalMemoryMonitor

Trait GlobalMemoryMonitor 

Source
pub trait GlobalMemoryMonitor: Send + Sync {
    // Required methods
    fn global_memory_info(&self) -> HashMap<Device, MemoryInfo>;
    fn global_memory_pressure(&self) -> MemoryPressure;
    fn register_manager(
        &mut self,
        device: Device,
        manager: &dyn DeviceMemoryManager,
    );
    fn unregister_manager(&mut self, device: &Device);
    fn set_global_pressure_callback(
        &mut self,
        callback: Box<dyn Fn(HashMap<Device, MemoryPressure>) + Send + Sync>,
    );
    async fn global_gc(&self) -> Result<HashMap<Device, DefragmentationStats>>;
}
Expand description

Global memory monitor for system-wide memory tracking

Required Methods§

Source

fn global_memory_info(&self) -> HashMap<Device, MemoryInfo>

Get memory information across all devices

Source

fn global_memory_pressure(&self) -> MemoryPressure

Get total system memory pressure

Source

fn register_manager( &mut self, device: Device, manager: &dyn DeviceMemoryManager, )

Register memory manager for monitoring

Source

fn unregister_manager(&mut self, device: &Device)

Unregister memory manager

Source

fn set_global_pressure_callback( &mut self, callback: Box<dyn Fn(HashMap<Device, MemoryPressure>) + Send + Sync>, )

Set global memory pressure callback

Source

async fn global_gc(&self) -> Result<HashMap<Device, DefragmentationStats>>

Force global garbage collection

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§