SUMMARY: How do I look at swap?

From: Randy Olsson (
Date: Wed Jul 13 1994 - 04:20:26 CDT

Original post:
> I am running Solaris 2.3 and my swap space keeps getting full. (85MB)
> How can I tell which processes are taking up how much swap space?

I'm not sure if I have the answer I was looking for as I have not had time
to check them all. My goal is to have a program that says "program A is
using 75% of swap, program B is using 5% of swap" or "program A is using
75MB of swap, program B is using 5MB of swap". I am trying to find out
who the hog is and how much it needs.

I should have been more specific.

The responses fell into one of the following categories:

1) Look at the SZ column from ps -el, do a man on ps to make sure. I think SZ
is the column you want.

the man page for ps says:
     SZ (l) The size (in pages or clicks) of the swap-
                      pable process's image in main memory.

This appears to give the size of the process in main memory, not in swap.
(What does this man page really say and how do I turn those numbers into
something useable like MB?)

2) I have a program called HP-Glance Plus that I bought from HP that works on
SUNs and HPs. It works really well and I highly recommend it.

I haven't checked this option.

3) cd /tmp; du

may show you some of the wasted area, because /tmp is a tmpfs in
Solaris 2.X by default....

This is a good possibility, but I had already checked it.

4) Get a copy of `top' - I have version 3.2 and it builds fine on Solaris
2.3 using gcc or the SunPro cc - not sure if there's a newer version around.

last pid: 24101; load averages: 0.20, 0.18, 0.14 08:48:14
58 processes: 57 sleeping, 1 on cpu
Memory: 25400K real, 1848K free, 34276K swap, 45556K free swap
20574 glenn 34 0 9796K 3556K sleep 153:07 0.00% 0.00% Xsun

This looks like a possible solution. I got top and did the configure before
the make, but it gave an error when it compiled. I have not had time to
see why. The SIZE and RES fields may be what I am looking for.

5) this isn't a generic answer, but one which might point you in the right
direction. ps -elf gives the size of each process' address space, so
you can look for large numbers there. If you're running NIS+, there's
a reasonable chance that rpc.nisd is your culprit, although nisd
*always* has a huge figure in the SZ column - it mmaps the address
space when it starts up, but doesn't actually use that much memory
until it needs to.

to find nisd's size, use /usr/lib/nis/nisstat, and check the dynamic
storage entry - that's the amount malloced by nisd, and unpatched, it
grabs lots. to fix that, you need patch 101329 (NIS+ jumbo patch) -
i've currently got -13 installed.

6) To look to the swap space you have to run the command

/usr/bin/swap -s

This only prints a summary - not who is using how much.

Thanks to: (Sorry if I missed you)
From: (Mike Wagner)
From: (Sumner Hushing)
From: (Larry J. Miller)
From: Colin Linahan <>
From: (Eckhard Rueggeberg)
From: (Tilman Sommer)
From: (Glenn Satchell - Uniq Professional Services)
From: (Steve_Kilbane)
From: Casper Dik <>
From: emsca!asm@Venezuela.Sun.COM (Angela Sarmiento Mendoza (soporte))

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:05 CDT