pub struct MemoryBlock {
pub address: usize,
pub size: usize,
pub allocated: bool,
pub move_priority: u32,
pub age: Duration,
pub access_frequency: f32,
pub last_access: Instant,
pub device_id: Option<usize>,
}Expand description
Memory block descriptor for defragmentation
Fields§
§address: usizeMemory address (pointer as usize for safety)
size: usizeSize in bytes
allocated: boolWhether the block is allocated or free
move_priority: u32Priority for moving (lower = higher priority to move)
age: DurationAge of the block (for generational strategies)
access_frequency: f32Access frequency (for hot/cold classification)
last_access: InstantLast access time
device_id: Option<usize>Associated device (for cross-device scenarios)
Implementations§
Source§impl MemoryBlock
impl MemoryBlock
Sourcepub fn new(address: usize, size: usize, allocated: bool) -> Self
pub fn new(address: usize, size: usize, allocated: bool) -> Self
Create a new memory block descriptor
Sourcepub fn is_adjacent_to(&self, other: &MemoryBlock) -> bool
pub fn is_adjacent_to(&self, other: &MemoryBlock) -> bool
Check if this block is adjacent to another block
Sourcepub fn can_merge_with(&self, other: &MemoryBlock) -> bool
pub fn can_merge_with(&self, other: &MemoryBlock) -> bool
Check if this block can be merged with another block
Sourcepub fn record_access(&mut self)
pub fn record_access(&mut self)
Update access statistics
Trait Implementations§
Source§impl Clone for MemoryBlock
impl Clone for MemoryBlock
Source§fn clone(&self) -> MemoryBlock
fn clone(&self) -> MemoryBlock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MemoryBlock
impl RefUnwindSafe for MemoryBlock
impl Send for MemoryBlock
impl Sync for MemoryBlock
impl Unpin for MemoryBlock
impl UnsafeUnpin for MemoryBlock
impl UnwindSafe for MemoryBlock
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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