Re: Memory leak of SMgrRelation object on standby
Jingtang Zhang <mrdrivingduck@gmail.com>
From: Jingtang Zhang <mrdrivingduck@gmail.com>
To: 邱宇航 <iamqyh@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>,
pgsql-hackers@lists.postgresql.org
Date: 2025-08-26T03:59:43Z
Lists: pgsql-hackers
Attachments
- v4-0001-Fix-SMgrRelation-object-memory-leak-during-startup-r.patch (application/octet-stream) patch v4-0001
Hi~ > I purpose a patch which calls smgrdestroyall() when redo each > XLOG_CHECKPOINT_ONLINE, so that it can keep the same frequency of calling > smgrdestroyall() as background processes on primary. I don't call it for > XLOG_CHECKPOINT_SHUTDOWN because the process is about to exit so that the > memory will go soon, and don't call it for XLOG_CHECKPOINT_REDO because it > seems to be a place holder only. Oops. When redo XLOG_CHECKPOINT_SHUTDOWN, smgrdestroyall should also be called, since the startup may not exit on standby. The patch is updated. — Regards, Jingtang
Commits
-
Fix leak with SMgrRelations in startup process
- e2dd7b2acf27 17.7 landed
- 039301b3fceb 18.0 landed
- 8c8f7b199d90 19 (unreleased) landed
-
Give SMgrRelation pointers a well-defined lifetime.
- 21d9c3ee4ef7 17.0 cited