Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9jEK-001gli-1H for pgsql-committers@arkaria.postgresql.org; Mon, 06 Apr 2026 12:39:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9jEI-008OI7-2e for pgsql-committers@arkaria.postgresql.org; Mon, 06 Apr 2026 12:38:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9jEI-008OHt-1v for pgsql-committers@lists.postgresql.org; Mon, 06 Apr 2026 12:38:59 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9jEG-00000000tkc-39q7 for pgsql-committers@lists.postgresql.org; Mon, 06 Apr 2026 12:38:58 +0000 Received: from [10.0.2.15] (unknown [130.41.208.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4fq85V6WGczytZ; Mon, 06 Apr 2026 15:38:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1775479135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gu2Vi+2b8AGvAFIqS6Megjcu6nfKfxOv0QxRsXiNMOY=; b=F7nQEjWvk62BjDGdwgjHiolQ6c19AMdJCElWMq1oGbmE3V/c6dif0XQXwaVgNV/aCo2TSy a4rRi6eLTTlh2k1jWxn4v5uXrV81fKAVsiQPFEVVh6Uipz8dSc6Uj6956w2nL0vmLT743f JnLS9b4rr/gkLd2NEXLCOn2YpRKvTDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1775479135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gu2Vi+2b8AGvAFIqS6Megjcu6nfKfxOv0QxRsXiNMOY=; b=tKu3Ridgd2fWBxol1OH8mDjvK2/dPSB0bDXLczvEraTrIfMl97wg2uuq+gf7OW37jU3up9 cuKUqSuSfnbxpytBrC3dsexKuipZHkGjwNdCK/ToIHTOvozWolpM08hb1To910/qxBk6qs JU8HG3NR8TbF+JO7H2+tp4ya6KLNiCI= ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=meesny; cv=none; t=1775479135; b=GT2nFQjCpfPAlK7M7jOjc1s464Ak2MhAJaAMV46bh9UEHC7vAQUe2XvfWT+xMm4QZ/DD0W YgAW9ZLqJ8jgKp+zquY6zdFBhcad6skrdVFnUDUJmcCoOBLRSwAo7oUiRA4r3fZUJIEweo 0mtdVQ5GECxccPg3VykSxuPFKGgucjs= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: <261dc9d4-0b87-4e7e-aded-842ed82298e5@iki.fi> Date: Mon, 6 Apr 2026 15:38:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Introduce a new mechanism for registering shared memory areas To: Aleksander Alekseev , pgsql-committers@lists.postgresql.org References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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