in reply to How to determine what the memory-limits of a CGI app are? [SOLVED]

How can I programmatically determine what the resource limits pertaining to the currently-running process are?

Maybe getrlimit(2) — at least that's the system call used under the hood of the shell builtin ulimit.

There's also the module BSD::Resource (a wrapper around the related system calls getrlimit, setrlimit, getrusage, etc.):

use BSD::Resource; my $rlimits = get_rlimits(); for my $rl (sort keys %$rlimits) { printf "%-15s : %s\n", $rl, getrlimit($rlimits->{$rl}); } __END__ RLIMIT_AS : 3412459520 RLIMIT_CORE : 0 RLIMIT_CPU : -1 RLIMIT_DATA : -1 RLIMIT_FSIZE : -1 RLIMIT_LOCKS : -1 RLIMIT_MEMLOCK : 32768 RLIMIT_NOFILE : 1024 RLIMIT_NPROC : 16383 RLIMIT_OFILE : 1024 RLIMIT_OPEN_MAX : 1024 RLIMIT_RSS : 1794068480 RLIMIT_STACK : 8388608 RLIMIT_VMEM : 3412459520