On Tue, Jan 16, 2024 at 1:18 PM Masahiko Sawada <sawada.m...@gmail.com> wrote: > Just changing "items" to be the local tidstore struct could make the > code tricky a bit, since max_bytes and num_items are on the shared > memory while "items" is a local pointer to the shared tidstore.
Thanks for trying it this way! I like the overall simplification but this aspect is not great. Hmm, I wonder if that's a side-effect of the "create" functions doing their own allocations and returning a pointer. Would it be less tricky if the structs were declared where we need them and passed to "init" functions? That may be a good idea for other reasons. It's awkward that the create function is declared like this: #ifdef RT_SHMEM RT_SCOPE RT_RADIX_TREE *RT_CREATE(MemoryContext ctx, Size max_bytes, dsa_area *dsa, int tranche_id); #else RT_SCOPE RT_RADIX_TREE *RT_CREATE(MemoryContext ctx, Size max_bytes); #endif An init function wouldn't need these parameters: it could look at the passed struct to know what to do.