From 605b8a383e54e9c9282d129f49bbe7c8a9f4f04e Mon Sep 17 00:00:00 2001 From: mrdrivingduck Date: Mon, 25 Aug 2025 23:46:06 +0800 Subject: [PATCH] Fix SMgrRelation object memory leak during startup redo --- src/backend/access/transam/xlog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 7ffb2179151..cadd390db39 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8438,6 +8438,14 @@ xlog_redo(XLogReaderState *record) checkPoint.ThisTimeLineID, replayTLI))); RecoveryRestartPoint(&checkPoint, record); + + /* + * After any checkpoint, free all smgr objects. Otherwise we + * would never do so for dropped relations, as the startup does + * not process shared invalidation messages or call + * AtEOXact_SMgr(). + */ + smgrdestroyall(); } else if (info == XLOG_OVERWRITE_CONTRECORD) { -- 2.39.5 (Apple Git-154)