Re: Parent/child context relation in pg_get_backend_memory_contexts()

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Melih Mutlu <m.melihmutlu@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Michael Paquier <michael@paquier.xyz>, torikoshia <torikoshia@oss.nttdata.com>, Andres Freund <andres@anarazel.de>, Stephen Frost <sfrost@snowman.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-07-25T03:08:47Z
Lists: pgsql-hackers
On Tue, 23 Jul 2024 at 22:14, Melih Mutlu <m.melihmutlu@gmail.com> wrote:
> Fixed the name. Also I needed to cast parameters when calling that function as below to get rid of some warnings.
>
> +       get_memory_context_name_and_ident(context,
> +                                                                         (const char **)&name,
> +                                                                         (const char **) &ident);

I ended up fixing that another way as the above seems to be casting
away the const for those variables. Instead, I changed the signature
of the function to:

static void get_memory_context_name_and_ident(MemoryContext context,
const char **const name,  const char **const ident);

which I think takes into account for the call site variables being
defined as "const char *".

David



Commits

  1. Add missing pointer dereference in pg_backend_memory_contexts view

  2. Add path column to pg_backend_memory_contexts view

  3. Allow memory contexts to have both fixed and variable ident strings.