Operating System - HP-UX
1832350 Members
2686 Online
110041 Solutions
New Discussion

Re: Swapinfo - wrong output

 
SOLVED
Go to solution
Przemyslaw Fafara
Occasional Advisor

Swapinfo - wrong output

Hello

I've write simple app which is allocating a lot of memory - aprox 24x256MB. My serwer has 2GB of physical ram and 4GB of swap memory. When I run my app swapinfo shows strange output:

# swapinfo -mta
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 0 4096 0% 0 - 1 /dev/vg00/lvol2
reserve - 4096 -4096
memory 2046 2045 1 100%
total 6142 6141 1 100% - 0 -

Whats the explanation of this?

Best regards
Przemek
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: Swapinfo - wrong output

Shalom,

HP-UX defines memory as RAM plus swap. It is treated as one pool and allocated as needed. When a process opens, it allocates swapspace, in the event that it needs to be swapped to disk.

This output tells me you have 2 GB of ram, 100% used and 4 GB of swap, which is not used at all.

The fact that swap is apparently not being used may be because your swap file is not active or is having disk problems.

Further checks on the system are warranted.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Przemyslaw Fafara
Occasional Advisor

Re: Swapinfo - wrong output

I've run sam, and in section about swap it says that swap is on. So whay swap is not working?
Steven E. Protter
Exalted Contributor

Re: Swapinfo - wrong output

Shalom,

To activate swap requires a reboot.

Take a look at /var/adm/syslog/syslog.log and /etc/rc.log

Perhaps there was a problem at startup time.

Also, it could simply be a display bug in swapinfo. Has the system been updated with a normal bi-annual patch update?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Swapinfo - wrong output

There is nothing wrong. You are using malloc() or calloc() either directly or indirectly in your code and the space is being reserved which means that it hasn't actually been allocated from your swap areas. If you now tried to assign values to these dynamically allocated variables that would trigger page faults which would in turn trigger the actual swap usage. It's a "just in time" swap usage scheme.
If it ain't broke, I can fix that.
Przemyslaw Fafara
Occasional Advisor

Re: Swapinfo - wrong output

Hi

System was rebooted and nothing has changed. I have two version's of HPUX system. 11.11 with goldpack running on C-class and 11.23 running on rp4400. On both systems situation is the same. In logs there are no error messages. I have no idea whats cause the problem.

Przemek
Przemyslaw Fafara
Occasional Advisor

Re: Swapinfo - wrong output

Hello

To: A. Clay Stephenson

You were right. I only invoked malloc function without setting value. When I use memset swap usage was diffrent than 0%. Thank you for your help.

Best regards
Przemek
Przemyslaw Fafara
Occasional Advisor

Re: Swapinfo - wrong output

Problem solved.