pub struct BudgetConfig { /* private fields */ }Expand description
Knobs that govern a MemoryBudget instance.
Construct via BudgetConfig::from_env or build by hand for
tests. Field values are absolute bytes (not MiB) so downstream
code never has to second-guess the unit.
Implementations§
Source§impl BudgetConfig
impl BudgetConfig
Sourcepub fn from_env(system_ram_bytes: Option<u64>) -> Self
pub fn from_env(system_ram_bytes: Option<u64>) -> Self
Resolve a config from environment variables.
Reads:
MEMORY_BUDGET_TARGET_MIB(overrides the auto-derived target)MEMORY_BUDGET_TICK_SECS(default5)MEMORY_BUDGET_HARD_CEILING_MIB(optional)
When MEMORY_BUDGET_TARGET_MIB is unset, the target is
min(0.8 × system_ram, 4096 MiB). system_ram_bytes is the
installed RAM as seen by sysinfo and is required when the
target is derived automatically.
Sourcepub fn target_bytes(&self) -> u64
pub fn target_bytes(&self) -> u64
Soft RSS target in bytes.
Sourcepub fn hard_ceiling_bytes(&self) -> Option<u64>
pub fn hard_ceiling_bytes(&self) -> Option<u64>
Optional hard abort ceiling.
Trait Implementations§
Source§impl Clone for BudgetConfig
impl Clone for BudgetConfig
Auto Trait Implementations§
impl Forget for BudgetConfig
impl Freeze for BudgetConfig
impl Move for BudgetConfig
impl RefUnwindSafe for BudgetConfig
impl Send for BudgetConfig
impl Sync for BudgetConfig
impl Unpin for BudgetConfig
impl UnsafeUnpin for BudgetConfig
impl UnwindSafe for BudgetConfig
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