On Sat, 31 Jul 2021 at 08:38, Andres Freund <and...@anarazel.de> wrote: > There is at least one path using tuplecontext that reaches code that > could end up freeing memory to a significant enough degree to care about > generation.c effectively not using that memory: > tuplesort_putdatum()->datumCopy()->EOH_flatten_into() > On a quick look I didn't find any expanded record user that frees > nontrivial amounts of memory, but I didn't look all that carefully.
I guess we could just use a normal context for datum sorts if we thought that might be a problem. I'm not too familiar with the expanded object code, but I'm struggling to imagine why anything would need to do a pfree in there. We just do EOH_get_flat_size() to determine how big to make the allocation then allocate some memory for EOH_flatten_into() to use to expand the object into. David