diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 71f5cf642356f2f4c9584a8ac1c47144889f90fd..7162efd06b4a06d10018ba170503bb7eae1cd9dc 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1111,10 +1111,6 @@ ExecutorEnd(QueryDesc *queryDesc) } END_MEMORY_ACCOUNT(); - if (gp_dump_memory_usage) - { - MemoryAccounting_SaveToFile(currentSliceId); - } ReportOOMConsumption(); } diff --git a/src/backend/utils/mmgr/memaccounting.c b/src/backend/utils/mmgr/memaccounting.c index e5a11c91df4e904df2111be3fc594857e3ab375a..51b1e578f403d398c35dadc6ffe441a2d30a9a2b 100644 --- a/src/backend/utils/mmgr/memaccounting.c +++ b/src/backend/utils/mmgr/memaccounting.c @@ -202,6 +202,11 @@ MemoryAccounting_Reset() */ if (MemoryAccounting_IsInitialized()) { + if (gp_dump_memory_usage) + { + MemoryAccounting_SaveToFile(currentSliceId); + } + /* No one should create child context under MemoryAccountMemoryContext */ Assert(MemoryAccountMemoryContext->firstchild == NULL);