Re: Memory leak of SMgrRelation object on standby

From: Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>
To: 邱宇航 <iamqyh(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Memory leak of SMgrRelation object on standby
Date: 2025-08-26 03:59:43
Message-ID: 32E74D1F-30A0-477C-998A-C83FD81597AF@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v4-0001-Fix-SMgrRelation-object-memory-leak-during-startup-r.patch application/octet-stream 1.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2025-08-26 04:28:30 Re: Improve pg_sync_replication_slots() to wait for primary to advance
Previous Message Alexandra Wang 2025-08-26 03:52:28 Re: SQL:2023 JSON simplified accessor support