Re: pgsql: Introduce a new mechanism for registering shared memory areas - Mailing list pgsql-committers

From Heikki Linnakangas
Subject Re: pgsql: Introduce a new mechanism for registering shared memory areas
Date
Msg-id 261dc9d4-0b87-4e7e-aded-842ed82298e5@iki.fi
Whole thread Raw
In response to Re: pgsql: Introduce a new mechanism for registering shared memory areas  (Aleksander Alekseev <aleksander@tigerdata.com>)
List pgsql-committers
On 06/04/2026 14:55, Aleksander Alekseev wrote:
>> Introduce a new mechanism for registering shared memory areas
>>
>> [...]
> 
> This commit introduced a memory leak which Valgrind is very much upset about.
> 
> ShmemRequestStructWithOpts() allocates a copy of `options` in
> TopMemoryContext and passes it to ShmemRequestInternal(). It appends
> it to pending_shmem_requests as request->options. Later in
> ShmemInitRequested() when the list is freed `->options` leak. There
> are similar issues in ShmemAttachRequested() and
> CallShmemCallbacksAfterStartup() which free pending_shmem_requests
> without freeing `->options`.
> 
> I propose to fix it as attached.

LGTM, I will push this shortly. Thanks!

- Heikki




pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: pgsql: Convert all remaining subsystems to use the new shmem allocation
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix memory leaks introduced by commit 283e823f9dcb