Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
7d0ab659
Commit
7d0ab659
authored
Mar 20, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for aggregate memory leaks from Erik Riedel.
parent
9ede8672
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
4 deletions
+76
-4
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+20
-2
src/backend/executor/execUtils.c
src/backend/executor/execUtils.c
+49
-1
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAgg.c
+3
-0
src/backend/executor/nodeResult.c
src/backend/executor/nodeResult.c
+4
-1
No files found.
src/backend/executor/execMain.c
View file @
7d0ab659
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.8
0 1999/03/19 18:56:36
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.8
1 1999/03/20 01:13:21
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -394,8 +394,26 @@ ExecutorEnd(QueryDesc *queryDesc, EState *estate)
...
@@ -394,8 +394,26 @@ ExecutorEnd(QueryDesc *queryDesc, EState *estate)
EndPlan
(
queryDesc
->
plantree
,
estate
);
EndPlan
(
queryDesc
->
plantree
,
estate
);
/* XXX - clean up some more from ExecutorStart() - er1p */
if
(
NULL
==
estate
->
es_snapshot
)
{
/* nothing to free */
}
else
{
if
(
estate
->
es_snapshot
->
xcnt
>
0
)
{
pfree
(
estate
->
es_snapshot
->
xip
);
}
pfree
(
estate
->
es_snapshot
);
}
if
(
NULL
==
estate
->
es_param_exec_vals
)
{
/* nothing to free */
}
else
{
pfree
(
estate
->
es_param_exec_vals
);
estate
->
es_param_exec_vals
=
NULL
;
}
/* restore saved refcounts. */
/* restore saved refcounts. */
BufferRefCountRestore
(
estate
->
es_refcount
);
BufferRefCountRestore
(
estate
->
es_refcount
);
}
}
void
void
...
@@ -580,7 +598,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
...
@@ -580,7 +598,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
/*
/*
* initialize result relation stuff
* initialize result relation stuff
*/
*/
if
(
resultRelation
!=
0
&&
operation
!=
CMD_SELECT
)
if
(
resultRelation
!=
0
&&
operation
!=
CMD_SELECT
)
{
{
/*
/*
...
...
src/backend/executor/execUtils.c
View file @
7d0ab659
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.4
3 1999/02/13 23:15:20
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.4
4 1999/03/20 01:13:22
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -272,6 +272,7 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
...
@@ -272,6 +272,7 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
#endif
#endif
i
++
;
i
++
;
}
}
if
(
len
>
0
)
if
(
len
>
0
)
{
{
ExecAssignResultType
(
commonstate
,
ExecAssignResultType
(
commonstate
,
...
@@ -368,6 +369,53 @@ ExecFreeProjectionInfo(CommonState *commonstate)
...
@@ -368,6 +369,53 @@ ExecFreeProjectionInfo(CommonState *commonstate)
commonstate
->
cs_ProjInfo
=
NULL
;
commonstate
->
cs_ProjInfo
=
NULL
;
}
}
/* ----------------
* ExecFreeExprContext
* ----------------
*/
void
ExecFreeExprContext
(
CommonState
*
commonstate
)
{
ExprContext
*
econtext
;
/* ----------------
* get expression context. if NULL then this node has
* none so we just return.
* ----------------
*/
econtext
=
commonstate
->
cs_ExprContext
;
if
(
econtext
==
NULL
)
return
;
/* ----------------
* clean up memory used.
* ----------------
*/
pfree
(
econtext
);
commonstate
->
cs_ExprContext
=
NULL
;
}
/* ----------------
* ExecFreeTypeInfo
* ----------------
*/
void
ExecFreeTypeInfo
(
CommonState
*
commonstate
)
{
TupleDesc
tupDesc
;
tupDesc
=
commonstate
->
cs_ResultTupleSlot
->
ttc_tupleDescriptor
;
if
(
tupDesc
==
NULL
)
return
;
/* ----------------
* clean up memory used.
* ----------------
*/
FreeTupleDesc
(
tupDesc
);
commonstate
->
cs_ResultTupleSlot
->
ttc_tupleDescriptor
=
NULL
;
}
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
* the following scan type support functions are for
* the following scan type support functions are for
* those nodes which are stubborn and return tuples in
* those nodes which are stubborn and return tuples in
...
...
src/backend/executor/nodeAgg.c
View file @
7d0ab659
...
@@ -110,6 +110,7 @@ ExecAgg(Agg *node)
...
@@ -110,6 +110,7 @@ ExecAgg(Agg *node)
isNull2
=
FALSE
;
isNull2
=
FALSE
;
bool
qual_result
;
bool
qual_result
;
Datum
oldVal
=
(
Datum
)
NULL
;
/* XXX - so that we can save and free on each iteration - er1p */
/* ---------------------
/* ---------------------
* get state info from node
* get state info from node
...
@@ -372,8 +373,10 @@ ExecAgg(Agg *node)
...
@@ -372,8 +373,10 @@ ExecAgg(Agg *node)
*/
*/
args
[
0
]
=
value1
[
aggno
];
args
[
0
]
=
value1
[
aggno
];
args
[
1
]
=
newVal
;
args
[
1
]
=
newVal
;
oldVal
=
value1
[
aggno
];
/* XXX - save so we can free later - er1p */
value1
[
aggno
]
=
(
Datum
)
fmgr_c
(
&
aggfns
->
xfn1
,
value1
[
aggno
]
=
(
Datum
)
fmgr_c
(
&
aggfns
->
xfn1
,
(
FmgrValues
*
)
args
,
&
isNull1
);
(
FmgrValues
*
)
args
,
&
isNull1
);
pfree
(
oldVal
);
/* XXX - new, let's free the old datum - er1p */
Assert
(
!
isNull1
);
Assert
(
!
isNull1
);
}
}
}
}
...
...
src/backend/executor/nodeResult.c
View file @
7d0ab659
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
* SeqScan (emp.all)
* SeqScan (emp.all)
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.
9 1999/02/13 23:15:26
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.
10 1999/03/20 01:13:22
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -263,6 +263,8 @@ ExecEndResult(Result *node)
...
@@ -263,6 +263,8 @@ ExecEndResult(Result *node)
* is freed at end-transaction time. -cim 6/2/91
* is freed at end-transaction time. -cim 6/2/91
* ----------------
* ----------------
*/
*/
ExecFreeExprContext
(
&
resstate
->
cstate
);
/* XXX - new for us - er1p */
ExecFreeTypeInfo
(
&
resstate
->
cstate
);
/* XXX - new for us - er1p */
ExecFreeProjectionInfo
(
&
resstate
->
cstate
);
ExecFreeProjectionInfo
(
&
resstate
->
cstate
);
/* ----------------
/* ----------------
...
@@ -276,6 +278,7 @@ ExecEndResult(Result *node)
...
@@ -276,6 +278,7 @@ ExecEndResult(Result *node)
* ----------------
* ----------------
*/
*/
ExecClearTuple
(
resstate
->
cstate
.
cs_ResultTupleSlot
);
ExecClearTuple
(
resstate
->
cstate
.
cs_ResultTupleSlot
);
pfree
(
resstate
);
node
->
resstate
=
NULL
;
/* XXX - new for us - er1p */
}
}
void
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment