On Mon, Apr 06, 2026 at 03:16:47AM +0300, Heikki Linnakangas wrote:
> We should use the memory that we've reserved, per the attached patch. One
> consequence of this fix though is that the allocations are now only
> MAXALIGNed, while ShmemAlloc() uses CACHELINEALIGN(). Not sure which we
> want.
Indeed, it's not right. Thanks for the report. I am pretty sure that
I intended each chunk to be MAXALIGN()-d for each custom stats kind
registered, allocated in a non-anonymous way, without cache alignment.
> I noticed this while working on the new shmem allocation functions, but it's
> a pre-existing bug in stable branches too.
Right, down to v18 where this has been introduced. That's my bug, so
I'd be OK to take care of it myself, if you are OK with that of
course.
Actually, shouldn't StatsShmemSize() use an add_size() for each
shared_size? Noted while passing through the code, extra error from
the same commit.
--
Michael