1847080 Members
4833 Online
110262 Solutions
New Discussion

Memory Breakup

 
SSP_1
Regular Advisor

Memory Breakup

Hi Guys,

I have a simple & straight-forward question. If my physical memory is 3500MB and I want to see how the breakup of memory is can I use UNIX95 command and take a total of vsz field?

If done so , I am getting total as 6500MB where is the physical mem of server is 3500MB, can anybody suggest how to derive a breakup of the physcial memory in use per process?
Obstacles exist to challenge you to keep going. Not to quit.
7 REPLIES 7
Ollie R
Respected Contributor

Re: Memory Breakup

Hi,

You need Glance. Install this, then use the utility "gpm" to see the required breakdown.

Ollie.
To err is human but to not award points is unforgivable
SSP_1
Regular Advisor

Re: Memory Breakup

Hi olie,

I have glance installed but don't have access to GUI so can't run gpm.

Is there any other method,,,,I mean from the character based display only by running glance.
Obstacles exist to challenge you to keep going. Not to quit.
Dagmar Boelen
Frequent Advisor

Re: Memory Breakup

Hi,

You can run glance in charactermode. Maybe the 6500MB did include virtual Memory?

Regards,

D.
Ollie R
Respected Contributor

Re: Memory Breakup

Hi,

You can see statistics for a particular process in "glance", but I think you have to select the process first and show the details, there's no way to show a listed summary of processes with memory use.

Unless "top" will give you what you want?

Ollie.
To err is human but to not award points is unforgivable
SSP_1
Regular Advisor

Re: Memory Breakup

Hi dagmar ,

The exact output for mem stats derived from glance is as below.

Total VM : 1.64gb Sys Mem : 212.9mb User Mem: 3.19gb Phys Mem: 3.50gb
Active VM: 755.9mb Buf Cache: 36.7mb Free Mem: 64.9mb

It shows the total mem = physical + virtual = 3.5+1.65 = 5.10 Gb
Obstacles exist to challenge you to keep going. Not to quit.
Dagmar Boelen
Frequent Advisor

Re: Memory Breakup

Hi,

Sounds I made correct quess. Please assign some points. (I have so little of them)
James Murtagh
Honored Contributor

Re: Memory Breakup

Hi Shirpad,

Calculating memory usage in this granularity can be quite tricky if you are not aware exactly how memory is laid out. See the process and memory management white papers for a good description. For example, if you have 20 processes connecting to a 500MB shared memory segment you don't want to add this 20 times to your count.

If you know C your best bet is the pstat interface if this is hpux 11.00 or higher. This can give you global counts or per-process counts of memory/VM. The short program below can be used as an introduction - it uses the pid as the argument and prints the data segment size. You can add more fields/calculations/error checking as you see fit, but I've tried to keep it short.

Regards,

James.

#include
#include
#include
#include

struct pst_status buf;

void main(int argc, char *argv[])
{
if(argc != 2) {
printf("Usage: %d \n", argv[0]);
exit(1);
}

int pid = atoi(argv[1]);

pstat_getproc(&buf, sizeof(struct pst_status), 0, pid);

printf("Data segment size for process %d is %d KB\n", pid, buf.pst_dsize*4);
}

Sample output:

# ./procvm 3678
Data segment size for process 3678 is 632 KB