Hi, I am trying to programatically determine the heap usage of a process. The idea is that when the heap grows beyond a point, the process gives up some of the memory it has allocated.
Looks like getrusage() won't help. I tried reading /proc/$$/psinfo. But that does not seem to be useful. This is what I tried: prpsinfo_t ps; sprintf(proc,"/proc/%d/psinfo", getpid()); for(i = 0; i < 100; i++) { if ((fd = open(proc, O_RDONLY)) == -1) { perror("open"); exit(1); } if(read(fd, &ps, sizeof(ps)) == -1) { perror("read"); exit(2); } close(fd); if( i == 0 || i == 99) printf("%lu, %lu\n", ps.pr_rssize, ps.pr_byrssize); malloc(1024 * (i+1)); } The output is like this: bash-3.00# ./rss 3561889832, 134509752 3561889832, 134509752 It does not show a change in pr_rssize. Is my understanding of pr_rssize wrong? Any clue as to what might be wrong? Regards, Manoj _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code