rlimit {unix}R Documentation

Resource Limits

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

rlimit_all()

rlimit_as(cur = NULL, max = NULL)

rlimit_core(cur = NULL, max = NULL)

rlimit_cpu(cur = NULL, max = NULL)

rlimit_data(cur = NULL, max = NULL)

rlimit_fsize(cur = NULL, max = NULL)

rlimit_memlock(cur = NULL, max = NULL)

rlimit_nofile(cur = NULL, max = NULL)

rlimit_nproc(cur = NULL, max = NULL)

rlimit_stack(cur = NULL, max = NULL)

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

# Print all limits
rlimit_all()

# Get one limit
rlimit_as()

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

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

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

## End(Not run)

[Package unix version 1.5.8 Index]