Release postmaster working memory context in slotsync worker

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Release postmaster working memory context in slotsync worker
Date: 2026-02-27 16:25:12
Message-ID: CAHGQGwHO05JaUpgKF8FBDmPdBUJsK22axRRcgmAUc2Jyi8OK8g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Child processes do not need the postmaster's working memory context and
release it at the start of their main function. However, the slotsync worker
appears to have missed this step.

To avoid this unnecessary memory usage, I'd like to propose that the slotsync
worker release the postmaster's working memory context at startup.
A patch is attached.

Currently, pg_log_backend_memory_contexts() reports the following
postmaster-related memory contexts in the slotsync worker:

LOG: level: 2; Postmaster: 21984 total in 2 blocks; 5600 free (7
chunks); 16384 used
LOG: level: 3; ident parser context: 1024 total in 1 blocks; 784
free (0 chunks); 240 used
LOG: level: 3; hba parser context: 25600 total in 6 blocks; 9864
free (11 chunks); 15736 used

With the attached patch, these contexts are no longer present.

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Release-postmaster-working-memory-context-in-slot.patch application/octet-stream 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2026-02-27 16:28:02 Re: DOCS - Add introductory paragraph to Getting Started chapter
Previous Message Joel Jacobson 2026-02-27 15:54:10 Re: [BUG?] estimate_hash_bucket_stats uses wrong ndistinct for avgfreq