initialize_memory_bounds

Function initialize_memory_bounds 

Source
pub fn initialize_memory_bounds(
    configuration: MemoryBoundsConfiguration,
    component_registry: &ComponentRegistry,
) -> Result<MemoryLimiter, GenericError>
Expand description

Initializes the memory bounds system and verifies any configured bounds.

If no memory limit is configured, or if the populated memory bounds fit within the configured memory limit, Ok(MemoryLimiter) is returned. The memory limiter can be used as a global limiter for the process, allowing callers to cooperatively participate in staying within the configured memory bounds by blocking when used memory exceeds the configured limit, until it returns below the limit. The limiter uses the effective memory limit, based on the configured slop factor.

ยงErrors

If the bounds could not be validated, an error is returned.