diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-02-15 21:47:08 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-02-15 21:47:08 +0000 |
commit | db3ac67d8f0e00949dcca3691ab00d1d2f8e1e72 (patch) | |
tree | 66a8747fb4cd75e7442ee99504728f8b76dbc052 /src/backend/executor | |
parent | 5c2abb960d6d8e97b17bd9876bb735b34747fe3a (diff) | |
download | postgresql-db3ac67d8f0e00949dcca3691ab00d1d2f8e1e72.tar.gz postgresql-db3ac67d8f0e00949dcca3691ab00d1d2f8e1e72.zip |
Update comments about memory management.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/nodeAgg.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 7c2ef8646b3..bfb2646b6a6 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -29,12 +29,24 @@ * of course). A non-strict finalfunc can make its own choice of * what to return for a NULL ending transvalue. * + * When the transvalue datatype is pass-by-reference, we have to be + * careful to ensure that the values survive across tuple cycles yet + * are not allowed to accumulate until end of query. We do this by + * "ping-ponging" between two memory contexts; successive calls to the + * transfunc are executed in alternate contexts, passing the previous + * transvalue that is in the other context. At the beginning of each + * tuple cycle we can reset the current output context to avoid memory + * usage growth. Note: we must use MemoryContextContains() to check + * whether the transfunc has perhaps handed us back one of its input + * values rather than a freshly palloc'd value; if so, we copy the value + * to the context we want it in. + * * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.73 2001/01/24 19:42:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.74 2001/02/15 21:47:08 tgl Exp $ * *------------------------------------------------------------------------- */ |