pub struct IntegratedMemoryManager { /* private fields */ }Expand description
Integrated memory management system
Implementations§
Source§impl IntegratedMemoryManager
impl IntegratedMemoryManager
Sourcepub fn new(config: MemoryManagementConfig) -> Self
pub fn new(config: MemoryManagementConfig) -> Self
Create new integrated memory manager
Sourcepub fn start_background_management(
&mut self,
) -> Result<(), MemoryManagementError>
pub fn start_background_management( &mut self, ) -> Result<(), MemoryManagementError>
Start background memory management
Sourcepub fn stop_background_management(&mut self)
pub fn stop_background_management(&mut self)
Stop background memory management
Sourcepub fn run_garbage_collection(
&mut self,
_memory_regions: &HashMap<usize, MemoryRegion>,
) -> Result<usize, MemoryManagementError>
pub fn run_garbage_collection( &mut self, _memory_regions: &HashMap<usize, MemoryRegion>, ) -> Result<usize, MemoryManagementError>
Run garbage collection
memory_regions describes the caller’s current view of live
allocations, but it is intentionally not registered with
GarbageCollectionEngine: that engine only selects a collector for
a region when region.utilization < mark_threshold (see
MarkSweepCollector::can_collect), while every region built by the
current caller is a single allocation at 100% utilization. Feeding
such regions in would turn every call into a hard
GCError::NoSuitableCollector instead of today’s harmless no-op.
Tracked as a finding rather than force-integrated; see the crate’s
lint/unwrap sweep notes.
Sourcepub fn prefetch(
&mut self,
address: *mut c_void,
size: usize,
access_pattern: Option<&str>,
) -> Result<bool, MemoryManagementError>
pub fn prefetch( &mut self, address: *mut c_void, size: usize, access_pattern: Option<&str>, ) -> Result<bool, MemoryManagementError>
Perform prefetch operation
Records the access with the PrefetchingEngine so its access-history
tracker and pattern strategies see real data; the returned bool
reflects whether this access was itself a hit against data the engine
had already prefetched (a genuine cache hit), not a fabricated value.
Sourcepub fn evict_memory(
&mut self,
target_bytes: usize,
memory_regions: &HashMap<usize, MemoryRegion>,
) -> Result<usize, MemoryManagementError>
pub fn evict_memory( &mut self, target_bytes: usize, memory_regions: &HashMap<usize, MemoryRegion>, ) -> Result<usize, MemoryManagementError>
Perform memory eviction
Registers memory_regions with the EvictionEngine (most-pressured,
then largest, region first) and evicts real objects from it via the
engine’s active policy until target_bytes have been reclaimed or
there is nothing left to evict. The returned count is the true sum of
evicted object sizes, not an estimate.
Sourcepub fn defragment(
&mut self,
_memory_regions: &HashMap<usize, MemoryRegion>,
) -> Result<usize, MemoryManagementError>
pub fn defragment( &mut self, _memory_regions: &HashMap<usize, MemoryRegion>, ) -> Result<usize, MemoryManagementError>
Run defragmentation
memory_regions is intentionally not registered with
DefragmentationEngine: both built-in compaction strategies require
MemoryLayoutTracker::get_total_free_space() > 0 to be eligible
(can_handle), but the current caller only ever reports one region
per live allocation with no free space (region size == its single
object’s size). Registering that data would not change the outcome
(DefragError::NoSuitableStrategy either way) and free-space
tracking would need to be added at the caller first. Tracked as a
finding rather than force-integrated; see the crate’s lint/unwrap
sweep notes.
Sourcepub fn handle_memory_pressure(
&mut self,
memory_usage_ratio: f64,
memory_regions: &HashMap<usize, MemoryRegion>,
) -> Result<(), MemoryManagementError>
pub fn handle_memory_pressure( &mut self, memory_usage_ratio: f64, memory_regions: &HashMap<usize, MemoryRegion>, ) -> Result<(), MemoryManagementError>
Check memory pressure and trigger appropriate management
Sourcepub fn update_access_pattern(
&mut self,
address: *mut c_void,
size: usize,
access_type: AccessType,
) -> Result<(), MemoryManagementError>
pub fn update_access_pattern( &mut self, address: *mut c_void, size: usize, access_type: AccessType, ) -> Result<(), MemoryManagementError>
Update access patterns for adaptive management
Feeds the access into the PrefetchingEngine’s access-history
tracker (mapped from this module’s coarse AccessType to
prefetching::AccessType) so its pattern strategies observe real
traffic instead of being permanently starved of data.
Sourcepub fn get_stats(&self) -> &ManagementStats
pub fn get_stats(&self) -> &ManagementStats
Get management statistics
Sourcepub fn get_gc_stats(&self) -> GCStats
pub fn get_gc_stats(&self) -> GCStats
Get garbage collection stats
Sourcepub fn get_prefetch_performance(&self) -> PrefetchPerformance
pub fn get_prefetch_performance(&self) -> PrefetchPerformance
Get prefetch performance
Sourcepub fn optimize_policies(&mut self) -> Result<(), MemoryManagementError>
pub fn optimize_policies(&mut self) -> Result<(), MemoryManagementError>
Optimize management policies based on workload
Auto Trait Implementations§
impl !RefUnwindSafe for IntegratedMemoryManager
impl !UnwindSafe for IntegratedMemoryManager
impl Freeze for IntegratedMemoryManager
impl Send for IntegratedMemoryManager
impl Sync for IntegratedMemoryManager
impl Unpin for IntegratedMemoryManager
impl UnsafeUnpin for IntegratedMemoryManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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