pub struct AllocationStrategyManager { /* private fields */ }Expand description
Core allocation strategy implementation
Implementations§
Source§impl AllocationStrategyManager
impl AllocationStrategyManager
pub fn new(strategy: AllocationStrategy) -> Self
pub fn with_adaptive_config(self, config: AdaptiveConfig) -> Self
pub fn with_hybrid_config(self, config: HybridConfig) -> Self
pub fn with_ml_config(self, config: MLConfig) -> Self
Sourcepub fn find_free_block(&mut self, size: usize) -> Option<*mut u8>
pub fn find_free_block(&mut self, size: usize) -> Option<*mut u8>
Find free block using the configured allocation strategy
Sourcepub fn find_first_fit(&mut self, size: usize) -> Option<*mut u8>
pub fn find_first_fit(&mut self, size: usize) -> Option<*mut u8>
First-fit allocation: Find first block that fits
Sourcepub fn find_best_fit(&mut self, size: usize) -> Option<*mut u8>
pub fn find_best_fit(&mut self, size: usize) -> Option<*mut u8>
Best-fit allocation: Find smallest block that fits
Sourcepub fn find_worst_fit(&mut self, size: usize) -> Option<*mut u8>
pub fn find_worst_fit(&mut self, size: usize) -> Option<*mut u8>
Worst-fit allocation: Find largest block that fits (reduces fragmentation)
Sourcepub fn find_buddy_block(&mut self, size: usize) -> Option<*mut u8>
pub fn find_buddy_block(&mut self, size: usize) -> Option<*mut u8>
Buddy system allocation: Find power-of-2 sized block
Sourcepub fn find_segregated_block(&mut self, size: usize) -> Option<*mut u8>
pub fn find_segregated_block(&mut self, size: usize) -> Option<*mut u8>
Segregated list allocation: Different size classes
Sourcepub fn find_adaptive_block(&mut self, size: usize) -> Option<*mut u8>
pub fn find_adaptive_block(&mut self, size: usize) -> Option<*mut u8>
Adaptive allocation based on allocation patterns and workload analysis
Sourcepub fn find_ml_based_block(&mut self, size: usize) -> Option<*mut u8>
pub fn find_ml_based_block(&mut self, size: usize) -> Option<*mut u8>
ML-based allocation using learned patterns
Sourcepub fn find_hybrid_block(&mut self, size: usize) -> Option<*mut u8>
pub fn find_hybrid_block(&mut self, size: usize) -> Option<*mut u8>
Hybrid allocation combining multiple strategies
Sourcepub fn analyze_allocation_patterns(&self) -> AllocationPattern
pub fn analyze_allocation_patterns(&self) -> AllocationPattern
Analyze allocation patterns from history
Sourcepub fn get_size_class(&self, size: usize) -> usize
pub fn get_size_class(&self, size: usize) -> usize
Get size class for segregated list allocation
Sourcepub fn add_free_block(&mut self, block: MemoryBlock)
pub fn add_free_block(&mut self, block: MemoryBlock)
Add free block to the pool
Sourcepub fn remove_free_block(
&mut self,
size: usize,
ptr: *mut u8,
) -> Option<MemoryBlock>
pub fn remove_free_block( &mut self, size: usize, ptr: *mut u8, ) -> Option<MemoryBlock>
Remove free block from the pool
Sourcepub fn get_stats(&self) -> &AllocationStats
pub fn get_stats(&self) -> &AllocationStats
Get current allocation statistics
Sourcepub fn get_strategy(&self) -> &AllocationStrategy
pub fn get_strategy(&self) -> &AllocationStrategy
Get current allocation strategy
Sourcepub fn set_strategy(&mut self, strategy: AllocationStrategy)
pub fn set_strategy(&mut self, strategy: AllocationStrategy)
Set new allocation strategy
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear allocation history
Sourcepub fn get_history(&self) -> &VecDeque<AllocationEvent>
pub fn get_history(&self) -> &VecDeque<AllocationEvent>
Get allocation history
Auto Trait Implementations§
impl Freeze for AllocationStrategyManager
impl RefUnwindSafe for AllocationStrategyManager
impl !Send for AllocationStrategyManager
impl !Sync for AllocationStrategyManager
impl Unpin for AllocationStrategyManager
impl UnwindSafe for AllocationStrategyManager
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
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