pub struct MemoryPolicy {
pub percent: u8,
pub ceiling: usize,
pub split: bool,
}Expand description
How a memory cache follows the machine: a share of the memory the user’s resident hosts could hold together, split between them.
Fields§
§percent: u8Share of (available memory + what the caches hold), in percent.
ceiling: usizeMost one process takes, in bytes.
split: boolSplit the share between the user’s registered processes.
Implementations§
Source§impl MemoryPolicy
impl MemoryPolicy
Sourcepub const FLOOR: usize
pub const FLOOR: usize
Least one process takes: below this the LRU would thrash on every query (it always keeps at least one entry anyway).
Sourcepub const CEILING_MIN: usize
pub const CEILING_MIN: usize
Bounds of the automatic ceiling (MemoryPolicy::auto_ceiling).
pub const CEILING_MAX: usize
Sourcepub fn for_device(device: &Device) -> MemoryPolicy
pub fn for_device(device: &Device) -> MemoryPolicy
The default policy for device.
Sourcepub fn auto_ceiling(total_memory: Option<u64>) -> usize
pub fn auto_ceiling(total_memory: Option<u64>) -> usize
A sixteenth of physical memory, within
MemoryPolicy::CEILING_MIN..=MemoryPolicy::CEILING_MAX: 2 GiB
up to 32 GB of memory (where a quarter of the available memory is
the tighter bound anyway), 6 GiB on a 96 GB machine. One server then
keeps a phone’s worth of hot DEX on a large machine, while sixteen
still split a quarter of it.
Sourcepub fn alone(&self, available: Option<u64>) -> usize
pub fn alone(&self, available: Option<u64>) -> usize
The budget of a process alone with available bytes free.
This process’s share: MemoryPolicy::percent of what the user’s
registered processes could hold together (the available memory plus
what their caches hold already), split evenly when
MemoryPolicy::split, within MemoryPolicy::FLOOR..=ceiling.
The ceiling when the available memory is unknown.