summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2015-11-20 11:30:03 +0000
committerPavan Deolasee2015-11-20 11:30:03 +0000
commit5dac85504a282d00e5a02352c71d516857ca85e4 (patch)
treee41efe67f59c5bdd729aef086e4eaeea306f13fa
parentab91bf134dd8066f90af1c88f3923852e6b14663 (diff)
Free memory allocated for tracking prepared statements.
This fixes a long-standing memory leak in the TopMemoryContext. Surprisingly, the reason why I started diagnosing the problem is because pgbench -S -c 1 would run significantly slowly with every iteration. The reason turned out be that AllocSetCheck() will run slower and slower (yeah, I was running with --enable-cassert like every other developer). That lead me to investigate for the memory leaks. This patch now fixes that issue and pgbench -S runs at a consistent speed, even for cassert enabled builds.
-rw-r--r--src/backend/utils/resowner/resowner.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c
index 20b12c2013..3bdfcbacea 100644
--- a/src/backend/utils/resowner/resowner.c
+++ b/src/backend/utils/resowner/resowner.c
@@ -490,6 +490,10 @@ ResourceOwnerDelete(ResourceOwner owner)
pfree(owner->files);
if (owner->dsms)
pfree(owner->dsms);
+#ifdef XCP
+ if (owner->stmts)
+ pfree(owner->stmts);
+#endif
pfree(owner);
}