Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c3281c

Browse files
committed
Reversed out Massimo patch.
1 parent 603e153 commit 0c3281c

File tree

6 files changed

+14
-111
lines changed

6 files changed

+14
-111
lines changed

src/backend/access/common/heaptuple.c

+3-26
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.52 1999/06/12 14:05:36 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.53 1999/06/12 14:07:20 momjian Exp $
1212
*
1313
* NOTES
1414
* The old interface functions have been converted to macros
@@ -27,11 +27,6 @@
2727
#include <storage/bufpage.h>
2828
#include <utils/memutils.h>
2929

30-
#ifdef FREE_TUPLE_MEMORY
31-
#include <utils/portal.h>
32-
#include <utils/trace.h>
33-
#endif
34-
3530
#ifndef HAVE_MEMMOVE
3631
#include <regex/utils.h>
3732
#else
@@ -98,9 +93,6 @@ DataFill(char *data,
9893
int i;
9994
int numberOfAttributes = tupleDesc->natts;
10095
Form_pg_attribute *att = tupleDesc->attrs;
101-
#ifdef FREE_TUPLE_MEMORY
102-
bool free_tuple_memory = pg_options[OPT_FREE_TUPLE_MEMORY];
103-
#endif
10496

10597
if (bit != NULL)
10698
{
@@ -139,14 +131,6 @@ DataFill(char *data,
139131
*infomask |= HEAP_HASVARLENA;
140132
data_length = VARSIZE(DatumGetPointer(value[i]));
141133
memmove(data, DatumGetPointer(value[i]), data_length);
142-
#ifdef FREE_TUPLE_MEMORY
143-
/* try to pfree value[i] - dz */
144-
if (free_tuple_memory &&
145-
PortalHeapMemoryIsValid(CurrentMemoryContext,
146-
(Pointer) value[i])) {
147-
pfree(value[i]);
148-
}
149-
#endif
150134
break;
151135
case sizeof(char):
152136
*data = att[i]->attbyval ?
@@ -163,15 +147,8 @@ DataFill(char *data,
163147
*((int32 *) value[i]));
164148
break;
165149
default:
166-
memmove(data, DatumGetPointer(value[i]), att[i]->attlen);
167-
#ifdef FREE_TUPLE_MEMORY
168-
/* try to pfree value[i] - dz */
169-
if (free_tuple_memory &&
170-
PortalHeapMemoryIsValid(CurrentMemoryContext,
171-
(Pointer) value[i])) {
172-
pfree(value[i]);
173-
}
174-
#endif
150+
memmove(data, DatumGetPointer(value[i]),
151+
att[i]->attlen);
175152
break;
176153
}
177154
data = (char *) att_addlength((long) data, att[i]->attlen, value[i]);

src/backend/executor/nodeAgg.c

+1-47
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
#include "utils/syscache.h"
3232
#include "optimizer/clauses.h"
3333

34-
#ifdef FREE_TUPLE_MEMORY
35-
#include <utils/portal.h>
36-
#include <utils/trace.h>
37-
#endif
38-
3934
/*
4035
* AggFuncInfo -
4136
* keeps the transition functions information around
@@ -118,9 +113,7 @@ ExecAgg(Agg *node)
118113
isNull1 = FALSE,
119114
isNull2 = FALSE;
120115
bool qual_result;
121-
#ifdef FREE_TUPLE_MEMORY
122-
bool free_tuple_memory = pg_options[OPT_FREE_TUPLE_MEMORY];
123-
#endif
116+
124117

125118
/* ---------------------
126119
* get state info from node
@@ -248,10 +241,6 @@ ExecAgg(Agg *node)
248241
for (;;)
249242
{
250243
TupleTableSlot *outerslot;
251-
#ifdef FREE_TUPLE_MEMORY
252-
Oid valueType;
253-
bool isByValue = 0;
254-
#endif
255244

256245
isNull = isNull1 = isNull2 = 0;
257246
outerslot = ExecProcNode(outerPlan, (Plan *) node);
@@ -304,31 +293,6 @@ ExecAgg(Agg *node)
304293
newVal = ExecEvalExpr(aggref->target, econtext,
305294
&isNull, &isDone);
306295
}
307-
#ifdef FREE_TUPLE_MEMORY
308-
if (free_tuple_memory) {
309-
switch (nodeTag(aggref->target)) {
310-
case T_Const:
311-
isByValue = ((Const*) (aggref->target))->constbyval;
312-
break;
313-
case T_Var:
314-
valueType = ((Var*) (aggref->target))->vartype;
315-
isByValue = typeByVal(typeidType(valueType));
316-
break;
317-
case T_Array:
318-
isByValue = ((Array*)(aggref->target))->arrayelembyval;
319-
break;
320-
case T_ArrayRef:
321-
isByValue =((ArrayRef*)(aggref->target))->refelembyval;
322-
break;
323-
case T_Expr:
324-
valueType = ((Expr*) (aggref->target))->typeOid;
325-
isByValue = typeByVal(typeidType(valueType));
326-
break;
327-
default:
328-
break;
329-
}
330-
}
331-
#endif
332296

333297
if (isNull && !aggref->usenulls)
334298
continue; /* ignore this tuple for this agg */
@@ -389,16 +353,6 @@ ExecAgg(Agg *node)
389353
(FmgrValues *) args, &isNull2);
390354
Assert(!isNull2);
391355
}
392-
393-
#ifdef FREE_TUPLE_MEMORY
394-
/* try to pfree newVal if not isByValue - dz */
395-
if (free_tuple_memory && !isByValue &&
396-
PortalHeapMemoryIsValid(CurrentMemoryContext,
397-
(Pointer) newVal))
398-
{
399-
pfree(newVal);
400-
}
401-
#endif
402356
}
403357

404358
/*

src/backend/utils/misc/trace.c

+4-7
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ static char *opt_names[] = {
7373
"syslog", /* use syslog for error messages */
7474
"hostlookup", /* enable hostname lookup in ps_status */
7575
"showportnumber", /* show port number in ps_status */
76-
#ifdef FREE_TUPLE_MEMORY
77-
"free_tuple_memory", /* try to pfree memory for each tuple */
78-
#endif
7976

8077
/* NUM_PG_OPTIONS */ /* must be the last item of enum */
8178
};
@@ -407,9 +404,9 @@ read_pg_options(SIGNAL_ARGS)
407404
}
408405

409406
/*
410-
* Local Variables:
411-
* tab-width: 4
412-
* c-indent-level: 4
413-
* c-basic-offset: 4
407+
* Local variables:
408+
* tab-width: 4
409+
* c-indent-level: 4
410+
* c-basic-offset: 4
414411
* End:
415412
*/

src/backend/utils/mmgr/portalmem.c

+1-19
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.20 1999/06/12 14:05:39 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.21 1999/06/12 14:07:26 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -289,24 +289,6 @@ PortalHeapMemoryFree(PortalHeapMemory this,
289289
}
290290
}
291291

292-
#ifdef FREE_TUPLE_MEMORY
293-
/*
294-
* PortalHeapMemoryIsValid --
295-
*
296-
* Check if a pointer is allocated in a memory context.
297-
*
298-
*/
299-
bool
300-
PortalHeapMemoryIsValid(MemoryContext context, Pointer pointer)
301-
{
302-
HeapMemoryBlock block = HEAPMEMBLOCK((PortalHeapMemory) context);
303-
304-
AssertState(PointerIsValid(block));
305-
306-
return (AllocSetContains(&block->setData, pointer));
307-
}
308-
#endif
309-
310292
/* ----------------
311293
* PortalHeapMemoryRealloc
312294
* ----------------

src/include/utils/portal.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: portal.h,v 1.14 1999/06/12 14:05:40 momjian Exp $
9+
* $Id: portal.h,v 1.15 1999/06/12 14:07:32 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -80,10 +80,6 @@ extern void EndPortalAllocMode(void);
8080
extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
8181
extern PortalHeapMemory PortalGetHeapMemory(Portal portal);
8282

83-
#ifdef FREE_TUPLE_MEMORY
84-
bool PortalHeapMemoryIsValid(MemoryContext context, Pointer pointer);
85-
#endif
86-
8783
/* estimate of the maximum number of open portals a user would have,
8884
* used in initially sizing the PortalHashTable in EnablePortalManager()
8985
*/

src/include/utils/trace.h

+4-7
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ enum pg_option_enum {
6464
OPT_SYSLOG, /* use syslog for error messages */
6565
OPT_HOSTLOOKUP, /* enable hostname lookup in ps_status */
6666
OPT_SHOWPORTNUMBER, /* show port number in ps_status */
67-
#ifdef FREE_TUPLE_MEMORY
68-
OPT_FREE_TUPLE_MEMORY, /* try to pfree memory for each tuple */
69-
#endif
7067

7168
NUM_PG_OPTIONS /* must be the last item of enum */
7269
};
@@ -86,9 +83,9 @@ extern int pg_options[NUM_PG_OPTIONS];
8683
#endif /* TRACE_H */
8784

8885
/*
89-
* Local Variables:
90-
* tab-width: 4
91-
* c-indent-level: 4
92-
* c-basic-offset: 4
86+
* Local variables:
87+
* tab-width: 4
88+
* c-indent-level: 4
89+
* c-basic-offset: 4
9390
* End:
9491
*/

0 commit comments

Comments
 (0)