Обсуждение: Memory Leakage Problem
Hi,
I setup a database server using the following configuration.
Redhat 9.0
Postgresql 8.0.3
Then, I setup a client workstation to access this database server with
the following configuration.
Redhat 9.0
unixODBC 2.2.11
psqlodbc-08.01.0101
and write a C++ program to run database query.
In this program, it will access this database server using simple and
complex (joining tables) SQL Select statement and retrieve the matched
rows. For each access, it will connect the database and disconnect it.
I found that the memory of the databaser server nearly used up (total 2G RAM).
After I stop the program, the used memory did not free.
Is there any configuration in postgresql.conf I should set? Currently,
I just set the following in postgresql.conf
listen_addresses = '*'
max_stack_depth = 8100 (when I run "ulimit -s" the max. value that
kernel supports = 8192)
stats_row_level = true
And, I run pg_autovacuum as background job.
--
Kathy Lo
Kathy Lo <kathy.lo.ky@gmail.com> writes:
> I found that the memory of the databaser server nearly used up (total 2G RAM).
> After I stop the program, the used memory did not free.
I see no particular reason to believe that you are describing an actual
memory leak. More likely, you are just seeing the kernel's normal
behavior of eating up unused memory for disk cache space.
Repeat after me: zero free memory is the normal and desirable condition
on Unix-like systems.
regards, tom lane
On Tue, 2005-12-06 at 03:22, Kathy Lo wrote:
> Hi,
>
> In this program, it will access this database server using simple and
> complex (joining tables) SQL Select statement and retrieve the matched
> rows. For each access, it will connect the database and disconnect it.
>
> I found that the memory of the databaser server nearly used up (total 2G RAM).
>
> After I stop the program, the used memory did not free.
Ummmm. What exactly do you mean? Can we see the output of top and / or
free? I'm guessing that what Tom said is right, you're just seeing a
normal state of how unix does things.
If your output of free looks like this:
-bash-2.05b$ free
total used free shared buffers cached
Mem:6096912 6069588 27324 0 260728 5547264
-/+ buffers/cache: 261596 5835316
Swap: 4192880 16320 4176560
Then that's normal.
That's the output of free on a machine with 6 gigs that runs a reporting
database. Note that while it shows almost ALL the memory as used, it is
being used by the kernel, which is a good thing. Note that 5547264 or
about 90% of memory is being used as kernel cache. That's a good thing.
Note you can also get yourself in trouble with top. It's not uncommon
for someone to see a bunch of postgres processes each eating up 50 or
more megs of ram, and panic and think that they're running out of
memory, when, in fact, 44 meg for each of those processes is shared, and
the real usage per backend is 6 megs or less.
Definitely grab yourself a good unix / linux sysadmin guide. The "in a
nutshell" books from O'Reilley (sp?) are a good starting point.