Expand description
Memory guard: checks RAM availability before loading the ONNX model. Memory guard: checks RAM availability before loading the ONNX model.
Loading the model via fastembed consumes approximately
crate::constants::EMBEDDING_LOAD_EXPECTED_RSS_MB MiB of resident memory.
Without this guard, multiple parallel invocations can exhaust RAM and trigger
OOM (Out-Of-Memory), stalling the system.
This guard queries the OS via sysinfo before any heavy initialisation,
aborting with crate::errors::AppError::LowMemory (exit 77) when the
configured floor is not met.
Functionsยง
- available_
memory_ mb - Returns the current available memory in MiB.
- calculate_
safe_ concurrency - Calculates the safe concurrency ceiling for heavy embedding workloads.
- check_
available_ memory - Checks whether sufficient memory is available to start loading the model.
- current_
process_ memory_ mb - Returns the current process RSS in MiB when available.