pub struct MemoryConfig {
pub max_allocations: usize,
pub max_history_age: Duration,
pub memory_limit_mb: usize,
pub enable_warnings: bool,
pub cleanup_threshold: f64,
pub batch_cleanup_size: usize,
pub enable_auto_compaction: bool,
pub compaction_interval: Duration,
}Expand description
Memory management configuration
Defines various limits and policies for memory tracking, ensuring controlled memory usage and good performance during long-term operation.
Fields§
§max_allocations: usizeMaximum number of allocation records
max_history_age: DurationMaximum retention time for historical records
memory_limit_mb: usizeMemory usage limit (MB)
enable_warnings: boolWhether to enable memory warnings
cleanup_threshold: f64Memory cleanup trigger threshold (0.0-1.0)
batch_cleanup_size: usizeBatch cleanup size
enable_auto_compaction: boolWhether to enable automatic compaction
compaction_interval: DurationCompaction trigger interval
Implementations§
Source§impl MemoryConfig
impl MemoryConfig
Sourcepub fn development() -> Self
pub fn development() -> Self
Create configuration for development environment (relaxed limits)
Sourcepub fn production() -> Self
pub fn production() -> Self
Create configuration for production environment (strict limits)
Sourcepub fn high_performance() -> Self
pub fn high_performance() -> Self
Create high-performance configuration (optimized for latency)
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate configuration validity
Sourcepub fn auto_adjust_for_system(&mut self) -> Result<(), ConfigError>
pub fn auto_adjust_for_system(&mut self) -> Result<(), ConfigError>
Auto-adjust configuration based on available system memory
Sourcepub fn for_current_system() -> Result<Self, ConfigError>
pub fn for_current_system() -> Result<Self, ConfigError>
Create configuration suitable for current system
Sourcepub fn estimate_memory_usage(&self) -> MemoryEstimate
pub fn estimate_memory_usage(&self) -> MemoryEstimate
Estimate memory usage under this configuration
Trait Implementations§
Source§impl Clone for MemoryConfig
impl Clone for MemoryConfig
Source§fn clone(&self) -> MemoryConfig
fn clone(&self) -> MemoryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryConfig
impl Debug for MemoryConfig
Auto Trait Implementations§
impl Freeze for MemoryConfig
impl RefUnwindSafe for MemoryConfig
impl Send for MemoryConfig
impl Sync for MemoryConfig
impl Unpin for MemoryConfig
impl UnwindSafe for MemoryConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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