Memory leak with palloc

From: Han Holl <han(dot)holl(at)prismant(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: Memory leak with palloc
Date: 2002-11-29 14:16:30
Message-ID: 200211291516.30424.han.holl@prismant.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello,

Let's say I want to run
select
count(column1) as column1,
count(column2) as column2,
...
count(column228) as column228
from aview;

coulumni are really function calls that return a computed
text that is palloc'd.
Postgres seems to free the palloc'd memory at the end of the
select statement, which means that the above query may of may
not succeed depending on machine size, database size and amount
of memory allocated.
Is there a way (and if there isn't, should there be) to tell
postgres either:
1. Please release this memory when you're done with this record.
or 2. Here is a pointer to static memory. Please don't free.

Both would solve my problem (and I guess 2 would be the more efficient).

Cheers,

Han Holl

PS The above query failed very quickly indeed on Postgres 7.2.3, (due to
memory exhaustion,) which seems to have a additional memory leak of it's
own. On 7.3RC2 it's running fine but consuming memory at a steady rate
(from 10M to 115M in 35 minutes, with 1.3G virtual memory I', confident
that it will complete).

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2002-11-29 14:23:39 Re: FETCH a cursor inside a SELECT
Previous Message David Crawshaw 2002-11-29 14:09:27 Re: FETCH a cursor inside a SELECT