This is an automated email from the ASF dual-hosted git repository.

avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit af49d1ba769964084da78a7ce3a255cf4248f09f
Author: Chris Hajas <[email protected]>
AuthorDate: Thu Sep 29 17:09:29 2022 -0700

    Fix memory leak in DynamicBitmapScans
    
    If a DynamicBitmapScan was under a NLJ, memory would increase very
    quickly and the system would soon terminate due to OOM. Additionally,
    performance was slower than an equivalent plan using regular Bitmap
    Scans. This only affected Orca as only Orca uses Dynamic Scans.
    
    This change had been done for regular index scans, but was not done for
    bitmap scans.
---
 src/backend/executor/nodeBitmapIndexscan.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/backend/executor/nodeBitmapIndexscan.c 
b/src/backend/executor/nodeBitmapIndexscan.c
index bc9c77357d..40bee5b7bc 100644
--- a/src/backend/executor/nodeBitmapIndexscan.c
+++ b/src/backend/executor/nodeBitmapIndexscan.c
@@ -223,9 +223,12 @@ ExecEndBitmapIndexScan(BitmapIndexScanState *node)
        indexScanDesc = node->biss_ScanDesc;
 
        /*
-        * Free the exprcontext ... now dead code, see ExecFreeExprContext
+        * Free the exprcontext(s) ... now dead code, see ExecFreeExprContext
+        *
+        * GPDB: This is not dead code in GPDB, because we don't want to leak
+        * exprcontexts in a dynamic bitmap index scan.
         */
-#ifdef NOT_USED
+#if 1
        if (node->biss_RuntimeContext)
                FreeExprContext(node->biss_RuntimeContext, true);
 #endif


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to