Heikki Linnakangas <hlinnaka@iki.fi> writes:
> On 08/16/2017 09:00 PM, Tom Lane wrote:
>> I don't buy that argument. A caller might think "Why do I need
>> shm_toc_estimate, when I can compute the *exact* size I need?".
>> And it would have worked, up till this proposed patch.
> Well, no. The size of the shm_toc struct is subtracted from the size
> that you give to shm_toc_create. As well as the sizes of the TOC
> entries. And those sizes are private to shm_toc.c, so a caller has no
> way to know what size it should pass to shm_toc_create(), in order to
> have N bytes of space actually usable. You really need to use
> shm_toc_estimate() if you want any guarantees on what will fit.
Good point --- objection withdrawn.
regards, tom lane