From 7714b60e5e69665b7cc9bf8f14d4fb104c98a3f2 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Wed, 23 Sep 2020 22:52:44 -0700 Subject: [PATCH] reset memory context at end of execution --- cstore_tableam.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cstore_tableam.c b/cstore_tableam.c index 312e10981..0e630d653 100644 --- a/cstore_tableam.c +++ b/cstore_tableam.c @@ -58,7 +58,7 @@ CStoreTableAMGetOptions(void) static MemoryContext -GetCStoreMemoryContext(void) +GetCStoreMemoryContext() { if (CStoreContext == NULL) { @@ -69,6 +69,16 @@ GetCStoreMemoryContext(void) } +static void +ResetCStoreMemoryContext() +{ + if (CStoreContext != NULL) + { + MemoryContextReset(CStoreContext); + } +} + + static void cstore_init_write_state(Relation relation) { @@ -591,6 +601,7 @@ CStoreExecutorEnd(QueryDesc *queryDesc) { standard_ExecutorEnd(queryDesc); } + ResetCStoreMemoryContext(); }