| From: | tgl(at)postgresql(dot)org (Tom Lane) |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Clean up a couple of problems in crosstab_hash's use of a hash |
| Date: | 2007-12-07 16:44:58 |
| Message-ID: | 20071207164458.D7B257540F0@cvs.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Log Message:
-----------
Clean up a couple of problems in crosstab_hash's use of a hash table.
The original coding leaked memory (at least 8K per crosstab_hash call)
because it allowed the hash table to be allocated as a child of
TopMemoryContext and then never freed it. Fix that by putting the
hash table under per_query_ctx, instead. Also get rid of use
of a static variable to point to the hash table. Aside from being
ugly, that would actively do the wrong thing in the case of re-entrant
calls to crosstab_hash, which are at least theoretically possible
since it was expecting the static variable to stay valid across
a SPI_execute call.
Modified Files:
--------------
pgsql/contrib/tablefunc:
tablefunc.c (r1.49 -> r1.50)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/tablefunc/tablefunc.c?r1=1.49&r2=1.50)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2007-12-07 16:53:31 | pgsql: Change documentation, change "distributed" checkpoints to |
| Previous Message | Peter Eisentraut | 2007-12-07 16:44:56 | pgsql: Realign the running text in this file to 79 characters wide. |