Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Apr 1998 20:07:19 -0400 (EDT)
From:      Dexnation Holodream <dex@wankers.net>
To:        Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= <dag-erli@ifi.uio.no>
Cc:        dyson@FreeBSD.ORG, Dan Swartzendruber <dswartz@druber.com>, dg@root.com, stable@FreeBSD.ORG, current@FreeBSD.ORG
Subject:   Re: swap-leak in 2.2.5 ?
Message-ID:  <Pine.BSF.3.96.980405195105.4132B-100000@localhost>
In-Reply-To: <xzpwwd3x395.fsf@hrotti.ifi.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
Well, folks, as was previously mentioned, the way to judge whether you
need more ram is your paging (see vmstat(8)), and, if you want to see how
much ram is being used, and how, and how much swap is being used, etc see
top(1).  both will provide you with real-time figures, and you can watch
what processes are doing.

for example:

last pid:  8019;  load averages:  0.35,  0.27,  0.20
19:54:08
47 processes:  1 running, 46 sleeping
CPU states:  2.7% user,  0.0% nice,  2.7% system,  0.8% interrupt, 93.8%
idle
Mem: 65M Active, 10M Inact, 14M Wired, 8335K Buf, 35M Free
Swap: 256M Total, 64K Used, 256M Free

the above is a paste from top running on my P133 w/ 128M of ram and 256M
of swap

or:

% vmstat 5
 procs      memory     page                    disks   faults      cpu
 r b w     avm   fre  flt  re  pi  po  fr  sr s0 c0   in   sy  cs us sy id
 1 2 0 4144276 35408    5   0   0   0   5   0  1  0  239  297  45  2  1 98
 0 2 0 4137596 35404    2   0   0   0   0   0  0  0  232  281  42  0  0 99
 0 2 0 4136312 35404    1   0   0   0   0   0  0  0  237  332  55  1  1 98

this is a 15 second long vmstat (5 second updates)

pi is page in, and po is page out.  As you can see, my machine is doing
very little as this is taken.  Now, watch what happens when I run two
instances of GIMP on top of this:

% vmstat 5
 procs      memory     page                    disks   faults      cpu
 r b w     avm   fre  flt  re  pi  po  fr  sr s0 c0   in   sy  cs us sy id
 2 2 0 4142396 35396    5   0   0   0   5   0  1  0  239  297  45  2  1 98
 0 3 0 4169616 32216  129   0   9   0  60   0 40  0  350 1249 220  7  7 86
 3 2 0 4191424 23416 1120  10   0   0  58 9623 126  0  431 2038 394 19 31
50
 1 5 0    4540 17792  638  13   4   0  18 19144 77  0  314 1076 258 33 26
40
 1 3 0    7220 18352  140   0   2   1   0 4824 24  0  253 27107 1840 61 29
10
 1 2 0    7940 16368  104  23   4   0  14   0  7  0  250 2068 363 23  7 70
 0 2 0    3136 16804   24   2   0   0  24 4791  0  0  267  631 109  2  4
94
 0 2 0    2412 16712    2   3   0   0   0   0  2  0  238  397  43  1  2 98
 0 2 0    3096 16712    0   0   0   0   0   0  0  0  236  281  42  0  1 99

As you can see, there has been some activity (granted, not much)

last pid:  8089;  load averages:  0.61,  0.44,  0.29
19:58:21
52 processes:  1 running, 51 sleeping
CPU states:  4.0% user,  0.0% nice,  4.4% system,  0.0% interrupt, 91.6%
idle
Mem: 93M Active, 32K Inact, 15M Wired, 16M Cache, 8348K Buf, 616K Free
Swap: 256M Total, 104K Used, 256M Free

% swapinfo
Device      1K-blocks     Used    Avail Capacity  Type
/dev/sd0b      262144    13976   248104     5%    Interleaved

Some swap has been used, here.

closing GIMP:

% !vm
vmstat 5
 procs      memory     page                    disks   faults      cpu
 r b w     avm   fre  flt  re  pi  po  fr  sr s0 c0   in   sy  cs us sy id
 2 2 0 4180640 16728    6   0   0   0   5   2  1  0  239  300  45  2  1 98
 0 2 0 4143644 54188   72  11   1   0 1952   0  1  0  282  851 157  5  5
90
 0 2 0 4144368 54188    1   0   0   0   0   0  2  0  250  341  58  1  1 98

last pid:  8148;  load averages:  0.16,  0.31,  0.25
20:00:51
48 processes:  2 running, 46 sleeping
CPU states:  1.2% user,  0.0% nice,  1.9% system,  0.8% interrupt, 96.1%
idle
Mem: 51M Active, 9160K Inact, 15M Wired, 15M Cache, 8340K Buf, 34M Free
Swap: 256M Total, 104K Used, 256M Free

as you can see, top still reflects data cached in swap, but look at
swapinfo:

% swapinfo
Device      1K-blocks     Used    Avail Capacity  Type
/dev/sd0b      262144       40   262040     0%    Interleaved

My interpretation, here, is that the data is still cached, but that space
will be reused if I don't run GIMP again, but will stay cached in case I
need it (OR there's a bug hidden somewhere).

-Jon

On 6 Apr 1998, Dag-Erling Coidan [iso-8859-1] Smørgrav wrote:

> "John S. Dyson" <dyson@FreeBSD.ORG> writes:
> > On my workstation, I run with 1.2GB of available swap space, and anybody
> > can afford that, can't they?  (BTW, I seldom use more than 30-40MB, but
> > with the price of disk, who cares?)
> 
> I only have 512 MB (out of 9 GB of disk space) but then again I have
> 128 MB RAM, so I practically never use any swap at all, except
> possibly while making world. On my laptop, however, I only have 16 MB
> RAM (should have been 32, but Big Three-Letter Computer Company (tm)
> screwed up and I'm still waiting for the missing RAM) so swap space
> gets eaten up PDQ.
> 
> -- 
> fprintf(stderr, "I have a closed mind. It helps keeping the rain out.\n");
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message
> 
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980405195105.4132B-100000>