diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-07-12 02:37:39 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-07-12 02:37:39 +0000 |
| commit | badce86a2c327b40c6146242526d1523455d64a6 (patch) | |
| tree | 6e0cb658889a2688e76d9ac19a56555c5eb0e738 /src/include/fmgr.h | |
| parent | 46fb9c29e2990ba470bb741ff6dd60f2ae218e64 (diff) | |
| download | postgresql-badce86a2c327b40c6146242526d1523455d64a6.tar.gz | |
First stage of reclaiming memory in executor by resetting short-term
memory contexts. Currently, only leaks in expressions executed as
quals or projections are handled. Clean up some old dead cruft in
executor while at it --- unused fields in state nodes, that sort of thing.
Diffstat (limited to 'src/include/fmgr.h')
| -rw-r--r-- | src/include/fmgr.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h index b0aea5df09..03d13e3d4e 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: fmgr.h,v 1.7 2000/07/06 05:48:17 tgl Exp $ + * $Id: fmgr.h,v 1.8 2000/07/12 02:37:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -119,6 +119,21 @@ extern struct varlena * pg_detoast_datum_copy(struct varlena * datum); #define PG_DETOAST_DATUM_COPY(datum) \ pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum)) +/* + * Support for cleaning up detoasted copies of inputs. This must only + * be used for pass-by-ref datatypes, and normally would only be used + * for toastable types. If the given pointer is different from the + * original argument, assume it's a palloc'd detoasted copy, and pfree it. + * NOTE: most functions on toastable types do not have to worry about this, + * but we currently require that support functions for indexes not leak + * memory. + */ +#define PG_FREE_IF_COPY(ptr,n) \ + do { \ + if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \ + pfree(ptr); \ + } while (0) + /* Macros for fetching arguments of standard types */ #define PG_GETARG_DATUM(n) (fcinfo->arg[n]) |
