Re: memory does not return back - Mailing list pgsql-bugs

From Richard Huxton
Subject Re: memory does not return back
Date
Msg-id 200402180927.45557.dev@archonet.com
Whole thread Raw
In response to memory does not return back  ("hessam" <hessam@jolfa.com>)
List pgsql-bugs
On Wednesday 18 February 2004 05:54, hessam wrote:
> Dear Richard,
>
> Thank you for your reply.Below are results of ps and top commands on
> my new linux Box:
>
> There are 64 database connection made by freeradius.When I reboot my
> machine with 'chkconfig postgresql off' 'chkconfig radiusd off' .
> nothing happens and everything is normal.Then I just start postgresql
> and do "select * form mytable;" memory goes up . The more select I do
> from different table, the more memory usage becomes.(whithout
> freeradius).And memory does not return back,but when I restart
> postgresql it goes down from 1GB to about 300Mb at the begining but
> after just minutes it reaches the top.Then I reboot linux with
> postgresql at the begining it is about 200 Mb but it takes hours to
> reach 1GB.

I see no evidence of high memory usage in the trace below - indeed the largest
memory usage is by the RedHat network config applet. If you look at the
figures, you have 144028KB used for buffering (144MB) and 960924KB for file
cache (960MB) along with 0 swap used.

>  08:56:26  up 18:51,  3 users,  load average: 0.01, 0.02, 0.00
> 133 processes: 132 sleeping, 1 running, 0 zombie, 0 stopped
> CPU0 states:   1.0% user   2.0% system    0.0% nice   0.0% iowait
> 96.3% idle
> CPU1 states:   1.0% user   1.1% system    0.0% nice   0.0% iowait
> 97.2% idle
> Mem:  2064420k av, 1512876k used,  551544k free,       0k shrd,
> 144028k buff
>                     495576k actv,  377752k in_d,  369380k in_c
> Swap: 2040244k av,       0k used, 2040244k free
> 960924k cached
>
>   PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU
> COMMAND
>  2514 root      15   0  4000 4000  1340 S     1.3  0.1   2:48   0
> radiusd
>  3089 root      15   0  6092 6088  5060 S     1.3  0.2  13:00   1
> magicdev
> 18985 root      16   0  1184 1184   856 R     0.7  0.0   0:00   0 top
>  2365 root      15   0  2972 2972  1436 S     0.3  0.1   0:08   0 cupsd
>  2599 postgres  15   0  5208 5208  3984 S     0.3  0.2   0:04   0
> postmaster
>  2609 postgres  15   0  5196 5196  3992 S     0.3  0.2   0:04   0
> postmaster
>  2718 root      16   0  1200 1200   856 S     0.3  0.0   3:39   1 top
>  3096 root      15   0 13408  13M  8704 S     0.3  0.6  10:27   1 rhn-
> applet-gu
[snip]

You do know that the "1512876k used" includes all this buffer/cache memory and
isn't really "in use"? If not, do some searching on Google for terms like
"linux out of memory buffer cache" - it confuses everybody the first time
they come across it.

Tip: try "free -m"
$ free -m
             total       used       free     shared    buffers     cached
Mem:           975        213        761          0         12        101
-/+ buffers/cache:         99        875
Swap:         1027          0       1027
Here the important values are on the second line - 99MB used, 875MB free.

If you still think there is a problem, can you show the output of "top" when
your system's memory usage increases. Tip: press "M" (not "m") to sort the
output by memory usage.

--
  Richard Huxton
  Archonet Ltd

pgsql-bugs by date:

Previous
From: Laurent FAILLIE
Date:
Subject: zlib directory in configure.
Next
From: "Rafael Villalobos Prats"
Date:
Subject: Select (str)::FLOAT8 BUG