Re: Enhancing Memory Context Statistics Reporting

Rahila Syed <rahilasyed90@gmail.com>

From: Rahila Syed <rahilasyed90@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>, torikoshia <torikoshia@oss.nttdata.com>, Robert Haas <robertmhaas@gmail.com>, Chao Li <li.evan.chao@gmail.com>
Date: 2026-02-24T11:57:17Z
Lists: pgsql-hackers

Attachments

Hi Daniel,

Thank you for the review. All the changes suggested in the v52comments.diff
are incorporated in the attached patches.

+#Server should have thrown error
> +$node->psql(
> +   'postgres',
> +   qq(select pg_get_process_memory_contexts($pid, true);),
> +   stderr => \$psql_err);
>
> This test doesn't validate that the server actually errored does it?
> (There is
> no proposed fix in the attached.)
>
>
This has been fixed by adding a check for the error returned by the above
command.
While at it, I also added another crash test to the file,  This is similar
to the existing
test for a client backend crash, but in this scenario, it crashes the
server process
instead.

Thank you,
Rahila Syed

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Cross-check lists of built-in LWLock tranches.

  2. Convert strncpy to strlcpy

  3. Typo and doc fixups for memory context reporting

  4. Add missing string terminator

  5. Rename argument in pg_get_process_memory_contexts().

  6. Add function to get memory context stats for processes