Re: Memory leak of SMgrRelation object on standby

邱宇航 <iamqyh@gmail.com>

From: 邱宇航 <iamqyh@gmail.com>
To: Jingtang Zhang <mrdrivingduck@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, pgsql-hackers@lists.postgresql.org
Date: 2025-08-25T02:46:43Z
Lists: pgsql-hackers
> 2025年8月21日 23:07,Jingtang Zhang <mrdrivingduck@gmail.com> 写道:
> 
> Also, in this situation, should startup process be treated as a background
> worker similar to bgwriter/checkpointer and call smgrdestroyall in some
> period?

Agree with that. Maybe we can call smgrdestroyall in startup process when
replaying CHECKPOINT records, just like bgwriter/checkpointer, which free
all smgr objects after any checkpoint.

Best regards,
Yuhang Qiu




Commits

  1. Fix leak with SMgrRelations in startup process

  2. Give SMgrRelation pointers a well-defined lifetime.