Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Process.getrlimit
(::interned | ::Integer resource) -> [ ::Integer, ::Integer ]
Process.getrlimit(resource) → [cur_limit, max_limit]
process.c
View on GitHub ↗
static VALUE
proc_getrlimit(VALUE obj, VALUE resource)
{
struct rlimit rlim;
if (getrlimit(rlimit_resource_type(resource), &rlim) < 0) {
rb_sys_fail("getrlimit");
}
return rb_assoc_new(RLIM2NUM(rlim.rlim_cur), RLIM2NUM(rlim.rlim_max));
}
Returns a 2-element array of the current (soft) limit and maximum (hard) limit for the given resource.
Argument resource specifies the resource whose limits are to be returned; see Process.setrlimit.
Each of the returned values cur_limit and max_limit is an integer; see Process.setrlimit.
Example:
Example
Process.getrlimit(:CORE) # => [0, 18446744073709551615]
See Process.setrlimit.
Not available on all platforms.