#mem #limits #resource #effective

bin+lib effective-limits

Estimate effective resource limits for a process e.g. how much RAM is available for use.

8 releases (4 breaking)

0.5.3 Jul 3, 2021
0.5.2 Oct 10, 2020
0.5.1 Jun 26, 2020
0.5.0 May 25, 2020
0.1.0 Feb 22, 2020

#33 in Configuration

Download history 107/week @ 2021-04-06 198/week @ 2021-04-13 185/week @ 2021-04-20 303/week @ 2021-04-27 239/week @ 2021-05-04 232/week @ 2021-05-11 150/week @ 2021-05-18 151/week @ 2021-05-25 77/week @ 2021-06-01 147/week @ 2021-06-08 132/week @ 2021-06-15 77/week @ 2021-06-22 113/week @ 2021-06-29 57/week @ 2021-07-06 49/week @ 2021-07-13 55/week @ 2021-07-20

696 downloads per month

Apache-2.0

24KB
503 lines

Estimate effective resource limits for a process

effective-limits is a mid-level API for determining the effective limits upon a process. It combines e.g. mem_info and getrlimit.

The goal is to have a good chance of avoiding failed allocations without requiring either developer or user a-priori selection of memory limits. That is, how much memory is effectively available for this process to use, considering the physical machine and ulimits, but not the impact of noisy neighbours, swappiness and so on. This limit can then be used to inform the size of in memory caches, put a threshold on in or output file buffers and so on.

#![warn(clippy::all)]

extern crate effective_limits;

fn main() -> effective_limits::Result<()> {
    println!("Effective mem limit: {}", effective_limits::memory_limit()?);
    Ok(())
}

Dependencies

~0.4–0.9MB
~21K SLoC