Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d873b5a

Browse files
author
Amit Kapila
committed
Fix memory leak due to LogicalRepRelMapEntry.attrmap.
When rebuilding the relation mapping on subscribers, we were not releasing the attribute mapping's memory which was no longer required. The attribute mapping used in logical tuple conversion was refactored in PG13 (by commit e1551f9) but we forgot to update the related code that frees the attribute map. Author: Hou Zhijie Reviewed-by: Amit Langote, Amit Kapila, Shi yu Backpatch-through: 10, where it was introduced Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com
1 parent 9c3e3d6 commit d873b5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/replication/logical/relation.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
260260
MemoryContext oldctx;
261261
int i;
262262

263+
/* Release the no-longer-useful attrmap, if any. */
264+
if (entry->attrmap)
265+
{
266+
pfree(entry->attrmap);
267+
entry->attrmap = NULL;
268+
}
269+
263270
/* Try to find and lock the relation by name. */
264271
relid = RangeVarGetRelid(makeRangeVar(remoterel->nspname,
265272
remoterel->relname, -1),

0 commit comments

Comments
 (0)