"out of memory" error - Mailing list pgsql-general

From Christian Schröder
Subject "out of memory" error
Date
Msg-id 46CC6D48.20904@deriva.de
Whole thread Raw
Responses Re: "out of memory" error  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
Hi list,
I am struggling with some "out of memory" errors in our PostgreSQL
database which I do not understand. Perhaps someone can give me a hint.
The application which causes the errors runs multi-threaded with 10
threads. Each of the threads performs several select statements on the
database. Some of the statements are rather complicated (joins over
mulitple tables etc.) From time to time some of the statements lead to
"out of memory" errors. The errors are not reproducable and if I run the
statements alone everything works fine.

When I watch the output of "free -m" while the application runs, the
used memory (without buffers) is always near 500 MB:
                 total       used       free     shared    buffers
cached
    Mem:          3954       3410        543          0          0
2942
    -/+ buffers/cache:        467       3486
    Swap:         2055        556       1498

These are the current settings from the server configuration:
    shared_buffers = 3GB
    work_mem = 8MB
    maintenance_work_mem = 256MB
    max_stack_depth = 4MB

The output of "ulimit -a" is as follows:
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 38912
    max locked memory       (kbytes, -l) 32
    max memory size         (kbytes, -m) 3441565
    open files                      (-n) 1024
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    stack size              (kbytes, -s) 8192
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 38912
    virtual memory          (kbytes, -v) 4922720
    file locks                      (-x) unlimited

The machine is a linux box with 4 GB memory running PostgreSQL 8.2.4.

I can post the details about the memory status from the log file if it
is needed.

Are there any configuration parameters that influence the amount of
available memory (besides "shared_buffers" which seems to be high enough)?

Thanks for any help!
    Christian

--
Deriva GmbH                         Tel.: +49 551 489500-42
Financial IT and Consulting         Fax:  +49 551 489500-91
Hans-Böckler-Straße 2                  http://www.deriva.de
D-37079 Göttingen

Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer


pgsql-general by date:

Previous
From: "Ed L."
Date:
Subject: Re: Converting non-null unique idx to pkey
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: "out of memory" error