Re: Bug #933: Too many inserts crash server

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mutex(at)redsheriff(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #933: Too many inserts crash server
Date: 2003-04-04 07:39:47
Message-ID: 3936.1049441987@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> If I create an external C function consisting of a
> simple loop that inserts 250000 records into a table
> the server process eventually crashes.

The memory leak goes away if you add

SPI_freetuptable(SPI_tuptable);

after the SPI_exec() call.

I am not sure whether to consider this an SPI bug or not. It's possibly
surprising that a non-SELECT query generates an empty tuple table; but
on the other hand, it's hard to say that no non-SELECT query can ever
generate a tuple table. (EXPLAIN is a counterexample, for instance.)

It may be better to document that you should always do
SPI_freetuptable() no matter what kind of query you executed.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert John Shepherd 2003-04-04 10:49:25 Rapid deteriation of performance (might be caused by tsearch?) in 7.3.2
Previous Message pgsql-bugs 2003-04-04 02:11:32 Bug #933: Too many inserts crash server