This is a discussion on ps v, LIM and setrlimit.... - Aix ; Hi AIX Folks, No matter what I've tried today, LIM column from the 'ps v' command always shows me 'xx' meaning unspecified. What am I doing wrong? We're trying to detect an ENOMEM problem in our customer's environment for our ...
Hi AIX Folks,
No matter what I've tried today, LIM column from the 'ps v' command
always shows me 'xx' meaning unspecified. What am I doing wrong? We're
trying to detect an ENOMEM problem in our customer's environment for
our process, but this value is alluding us.
>From man ps,
.......
LIM
(v flag) The soft limit on memory used, specified via a
call to the setrlimit subroutine. If no limit has been specified, then
shown as xx. If the limit is set to the system limit, (unlimited), a
value of UNLIM is displayed.
........
I wrote a little code below, and the result from getrlimit shows the
values I'd expect, but the ps value for LIM is always xx, even if I use
RLIM_INFINITY. And the SIZE column seems incorrect.
$ cat main.cpp
#include
#include
#include
#include
#include
#include
using namespace std;
int main(int argc, char * const * const argv)
{
auto_ptrr(new rlimit());
r->rlim_cur=16382*1024;
r->rlim_max=32768*1024;
cout << r.get() << endl;
if (0 > setrlimit(RLIMIT_DATA,r.get()))
{
cout << "setrlimit(RLIM_DATA) failed: " << errno <<
endl;
}
if (0 > getrlimit(RLIMIT_DATA, r.get()))
{
cout << "getrlimit(RLIM_DATA) failed: " << errno <<
endl;
}
cout << "Limits are cur: " << r->rlim_cur << "\tmax: " <<
r->rlim_max << endl;
stringstream p;
p << "ps gv | grep " << argv[0];
cout << p.str() << endl;
system(p.str().c_str());
// wait indefinitely....
sigset_t ss;
sigemptyset(&ss);
sigaddset(&ss, SIGCONT);
sigwaitinfo(&ss,NULL);
return 1;
}
output:
$ ./a.out&
[1] 34388
$ 200019c8
Limits are cur: 16775168 max: 33554432
ps gv | grep -e PID -e ./a.out
PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM
COMMAND
75744 pts/0 A 0:00 0 34359738656 34359738808 xx 73
152 0.0 987998.0 ./a.out
This was my ulimit to begin:
$ ulimit -aH
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 4194304
memory(kbytes) unlimited
coredump(blocks) unlimited
nofiles(descriptors) unlimited
$ ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 1048576
memory(kbytes) unlimited
coredump(blocks) unlimited
nofiles(descriptors) unlimited
And this is my oslevel:
$ oslevel -r
5300-04