Thread: General Bug Report: This message appears "malloc: cannot allocate memory"

General Bug Report: This message appears "malloc: cannot allocate memory"

From
Unprivileged user
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Edmund P. Morgan
Your email address      : emorgan@southfield.cups.com

Category                : runtime: back-end: SQL
Severity                : critical

Summary: This message appears "malloc: cannot allocate memory"

System Configuration
--------------------
  Operating System   : Linux RedHat 5.2 & 5.0

  PostgreSQL version : 6.3.1 and 6.2.1

  Compiler used      : gcc 2.7 +

Hardware:
---------
Pentium 400 Mhz, 128 Ram, 10 GB hard disk, the database resides on the first partition 4.0 GB

Versions of other tools:
------------------------


--------------------------------------------------------------------------

Problem Description:
--------------------
I created a database and one table that contains about nine fields. The record size is less that 810 bytes. The table
contains500,000 rows. When enter this sql statement "select * from ptest", the following message is displayed 
"malloc: cannot allocate memory". This select statement uses all but 1024K of physical memory and all of the virtual
memory (hard disk space) before the process can't allocate
any more memory. Is the back-end database process
(utils/mmgr) trying to return the entire dataset? This
process should be returning the max amount of configurable
memory (ie: 32 MB) per dataset until all of the rows have
been retrieved. Is there a configurable switch to set to
allow the datasets to be buffered.

--------------------------------------------------------------------------

Test Case:
----------
The following is the table layout:

create table test
(
        relrec int4,
        dum1 char(100),
        dum2 char(100),
        dum3 char(100),
        dum4 char(100),
        dum5 char(100),
        dum6 char(100),
        dum7 char(100),
        dum8 char(100)
);

--------------------------------------------------------------------------

Solution:
---------
Set aside a configuable buffer memory switch that the
datasets will use the max. buffer size the switch is set to.
The database process will use this buffer size until all
rows are returned.

--------------------------------------------------------------------------