diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-29 00:39:20 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-29 00:39:20 +0000 |
| commit | 0d54d6ac44444c05f7c0f5058d3d3f32cc188b48 (patch) | |
| tree | cccee5d61e1afc1982c363ed3e4876a09ed82b52 /src/include/executor/tuptable.h | |
| parent | 51cd0377460839d25a5fc5f2a2499de43126a3b2 (diff) | |
| download | postgresql-0d54d6ac44444c05f7c0f5058d3d3f32cc188b48.tar.gz | |
Clean up handling of tuple descriptors so that result-tuple descriptors
allocated by plan nodes are not leaked at end of query. This doesn't
really matter for normal queries, but it sure does for queries invoked
repetitively inside SQL functions. Clean up some other grotty code
associated with tupdescs, and fix a few other memory leaks exposed by
tests with simple SQL functions.
Diffstat (limited to 'src/include/executor/tuptable.h')
| -rw-r--r-- | src/include/executor/tuptable.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h index 47018666a7..7def0be4b6 100644 --- a/src/include/executor/tuptable.h +++ b/src/include/executor/tuptable.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: tuptable.h,v 1.17 2001/01/24 19:43:23 momjian Exp $ + * $Id: tuptable.h,v 1.18 2001/01/29 00:39:20 tgl Exp $ * * NOTES * The tuple table interface is getting pretty ugly. @@ -22,27 +22,36 @@ /* ---------------- * The executor tuple table is managed and manipulated by special - * code in executor/execTuples.c and tupTable.h + * code in executor/execTuples.c. * * TupleTableSlot information * - * shouldFree boolean - should we call pfree() on tuple + * val current tuple, or NULL if no tuple + * shouldFree boolean - should we pfree() tuple * descIsNew boolean - true when tupleDescriptor changes - * tupleDescriptor type information kept regarding the tuple data + * tupleDescriptor type information for the tuple data + * shouldFreeDesc boolean - should we free tupleDescriptor * buffer the buffer for tuples pointing to disk pages * * The executor stores pointers to tuples in a ``tuple table'' - * which is composed of TupleTableSlot's. Some of the tuples - * are pointers to buffer pages and others are pointers to - * palloc'ed memory and the shouldFree variable tells us when + * which is composed of TupleTableSlots. Sometimes the tuples + * are pointers to buffer pages, while others are pointers to + * palloc'ed memory; the shouldFree variable tells us when * we may call pfree() on a tuple. -cim 9/23/90 * + * If buffer is not InvalidBuffer, then the slot is holding a pin + * on the indicated buffer page; drop the pin when we release the + * slot's reference to that buffer. + * * In the implementation of nested-dot queries such as * "retrieve (EMP.hobbies.all)", a single scan may return tuples * of many types, so now we return pointers to tuple descriptors * along with tuples returned via the tuple table. -cim 1/18/90 * - * Tuple table macros are all excised from the system now. + * shouldFreeDesc is similar to shouldFree: if it's true, then the + * tupleDescriptor is "owned" by the TupleTableSlot and should be + * freed when the slot's reference to the descriptor is dropped. + * * See executor.h for decls of functions defined in execTuples.c * -jolly * @@ -54,6 +63,7 @@ typedef struct TupleTableSlot HeapTuple val; bool ttc_shouldFree; bool ttc_descIsNew; + bool ttc_shouldFreeDesc; TupleDesc ttc_tupleDescriptor; Buffer ttc_buffer; } TupleTableSlot; |
