Re: CLOBBER_CACHE_ALWAYS regression instability

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: CLOBBER_CACHE_ALWAYS regression instability
Дата
Msg-id 20200406000715.sf7tnh4og7oncscl@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: CLOBBER_CACHE_ALWAYS regression instability  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Hi,

On 2020-04-05 19:54:19 -0400, Alvaro Herrera wrote:
> Isn't it the case that you can create an inner block with a constant
> whose size is determined by a containing block's variable?  I mean as in
> the attached, which refuses to compile because of our -Werror=vla -- but
> if I remove it, it compiles fine and works in my system.

IIRC msvc doesn't support VLAs. And there's generally a slow push
towards deprecating them (they've e.g. been moved to optional in C11).

They don't tend to make a lot of sense for sizes that aren't tightly
bound. In contrast to palloc etc, there's no good way to catch
allocation errors. Most of the time you'll just get a SIGBUS or such,
but sometimes you'll just end up overwriting data (if the allocation is
large enough to not touch the guard pages).

Both alloca/vlas also add some per-call overhead.

Allocating the common size on-stack, and the uncommon ones on heap
should be cheaper, and handles the cases of large allocations much
better.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Grigory Smolkin
Дата:
Сообщение: archive recovery fetching wrong segments
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: nbtree: assertion failure in _bt_killitems() for posting tuple