Re: repack: fix uninitialized DecodingWorkerShared.initialized - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: repack: fix uninitialized DecodingWorkerShared.initialized
Date
Msg-id CA+hUKG+YxHMjaSzhgsXd9stiAiaQCjsM9Q2u+_emCBrN_iqvdg@mail.gmail.com
Whole thread
In response to repack: fix uninitialized DecodingWorkerShared.initialized  (Chao Li <li.evan.chao@gmail.com>)
List pgsql-hackers
On Thu, Apr 16, 2026 at 2:17 AM Chao Li <li.evan.chao@gmail.com> wrote:
> I checked the code of dsm_create(), and I did not see anything showing that the created shared-memory segment is
zeroed.
>
> This is actually just an eyeball finding. From my tracing on my MacBook, after shared = (DecodingWorkerShared *)
dsm_segment_address(seg);,the memory always seemed to be zeroed, so I may have missed something. But given that the
codeexplicitly initializes several other fields, it seems better not to rely on that implicitly. 

For the record, that depends on whether you get a newly allocated
shared memory segment from the operating system, or recycled shared
memory reserved at startup with the min_dynamic_shared_memory setting
(as shown in Alexander Lakhin's reproducer).



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition
Next
From: Amit Kapila
Date:
Subject: Re: DOCS - CREATE PUBLICATION ... EXCEPT missing details on ONLY