Re: pgsql: Fix valgrind failure - Mailing list pgsql-committers

From Bertrand Drouvot
Subject Re: pgsql: Fix valgrind failure
Date
Msg-id adTRZrIyZjAhFj9h@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread
In response to pgsql: Fix valgrind failure  (Álvaro Herrera <alvherre@kurilemu.de>)
Responses Re: pgsql: Fix valgrind failure
List pgsql-committers
Hi,

On Tue, Apr 07, 2026 at 09:15:34AM +0000, Álvaro Herrera wrote:
> Fix valgrind failure
> 
> Buildfarm member skink reports that the new REPACK code is trying to
> write uninitialized bytes to disk, which correspond to padding space in
> the SerializedSnapshotData struct.  Silence that by initializing the
> memory in SerializeSnapshot() to all zeroes.

-       SerializedSnapshotData serialized_snapshot;
+       SerializedSnapshotData serialized_snapshot = {0};

Should we use memset() instead? As "= {0}" is guaranteed to zero padding bytes
(for object that has automatic storage duration) as of C23 (see Andres's reply
in [0]) but we require C11 so far.

I wonder if we should introduce a new macro say "INITIALIZE_PADDING" that I
proposed in [1].

[0]: https://postgr.es/m/aoaj45foewpjtu6r5cs67yrx4en3pkurs23e4azv6tbikpw6c3%40h3pnaqaksoeg
[1]: https://postgr.es/m/ablMZvnGhX8h5GgK%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Add isolation tests for UPDATE/DELETE FOR PORTION OF
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Optimize sort and deduplication in ginExtractEntries()