Re: BUG #3680: memory leak when excuting a SQL "selectcount(id) from chinatelecom;" - Mailing list pgsql-bugs

From Douglas Toltzman
Subject Re: BUG #3680: memory leak when excuting a SQL "selectcount(id) from chinatelecom;"
Date
Msg-id 5A75E109-39A6-4A7E-AD84-7237679FBCAF@oakstreetsoftware.com
Whole thread Raw
In response to Re: BUG #3680: memory leak when excuting a SQL "selectcount(id) from chinatelecom;"  ("ssurui" <ssurui@mailst.xjtu.edu.cn>)
List pgsql-bugs
Actually, the reason for utilizing all available RAM is to improve=20=20
efficiency.  There is no cost to leaving things in core, in case they=20=20
will can be re-used.  It takes virtually no time to make pages=20=20
available when they are needed.  The only cost is in managing=20=20
utilization maps, but accessing the hard drive takes milliseconds=20=20
where getting something from RAM takes nanoseconds.  It's really an=20=20
operating system thing, not a Postgres issue.

On Oct 17, 2007, at 9:04 PM, ssurui wrote:

> Thank you for the explanations.
>
> My program is running 4 months, it has never exit because of the=20=20
> shortage of memory. But the =91free=92 memory (observing by top=20=20
> command) is kept on about 20MB (The database server has 2GB DDR RAM).
>
>
>
> According to you explanations, when I =93malloc=94 a buffer of 30MB,=20=
=20
> the cache will be reduced to give me 30MB. I think it is true. So=20=20
> another question is whether the efficiency of program is affected=20=20
> to go down?
>
>=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20
> ssurui@mailst.xjtu.edu.cn
>
>
>
> ----------------------------------------------------------------------=20
> ----------------------------------------------------------------------=20
> --
>
> I think the one thing everyone knows as a fact is that the memory=20=20
> did not vanish.  Your latest message gives us a clue that what=20=20
> interests you is why free (unused, idle, not giving you any=20=20
> benefit) memory went down.  If that is the question, it is because=20=20
> PostgreSQL goes through the OS file systems, so RAM which is=20=20
> serving no other purpose will automatically be used to cache data.=20=20=
=20
> If you need memory for something else, the cache will be reduced to=20=20
> compensate.
>
>
>
> -Kevin
>
>
Douglas Toltzman
doug@oakstreetsoftware.com
(910) 526-5938

pgsql-bugs by date:

Previous
From: "ssurui"
Date:
Subject: Re: BUG #3680: memory leak when excuting a SQL "selectcount(id) from chinatelecom;"
Next
From: ITAGAKI Takahiro
Date:
Subject: Re: BUG #3681: fillers are NULL in pgbench