]> granicus.if.org Git - postgresql/commitdiff
release memory used while flushing logical mappings
authorBruce Momjian <bruce@momjian.us>
Tue, 22 Apr 2014 22:05:44 +0000 (18:05 -0400)
committerBruce Momjian <bruce@momjian.us>
Tue, 22 Apr 2014 22:05:44 +0000 (18:05 -0400)
Patch by Ants Aasma

src/backend/access/heap/rewriteheap.c

index 4cf07eaa2e4cfae2e2928a75599fd3e90d40caca..ae439e8d6f1454b6ef4abe3c8fa4aca4ccfb2610 100644 (file)
@@ -897,7 +897,7 @@ logical_heap_rewrite_flush_mappings(RewriteState state)
 
                /* write all mappings consecutively */
                len = src->num_mappings * sizeof(LogicalRewriteMappingData);
-               waldata = palloc(len);
+               waldata = MemoryContextAlloc(state->rs_cxt, len);
                waldata_start = waldata;
 
                /*
@@ -943,6 +943,7 @@ logical_heap_rewrite_flush_mappings(RewriteState state)
                /* write xlog record */
                XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_REWRITE, rdata);
 
+               pfree(waldata);
        }
        Assert(state->rs_num_rewrite_mappings == 0);
 }