rlimit: Resource Limits

Description Usage Arguments Details References Examples

Description

Get and set process resource limits. Each function returns the current limits, and can optionally update the limit by passing argument values. The rlimit_all() function is a convenience wrapper which prints all current hard and soft limits.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19

Arguments

cur

set the current (soft) limit for this resource. See details.

max

set the max (hard) limit for this resource. See details.

Details

Each resource has an associated soft and hard limit. The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit: an unprivileged process may set only its soft limit to a value in the range from 0 up to the hard limit, and (irreversibly) lower its hard limit.

Definitons from the Linux manual page are as follows:

Note that the support for enforcing limits very widely by system. In particular RLIMIT_AS has a different meaning depending on how memory allocation is managed by the operating system (and doesn't work at all on MacOS).

References

GETRLIMIT(2)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Print all limits
rlimit_all()

# Get one limit
rlimit_as()

# Set a soft limit
lim <- rlimit_as(1e9)
print(lim)

# Reset the limit to max
rlimit_as(cur = lim$max)

## Not run: 
# Set a hard limit (irreversible)
rlimit_as(max = 1e10)

## End(Not run)

unix documentation built on Jan. 31, 2020, 5:07 p.m.

Related to rlimit in unix...