Re: why declare arg as a array in FunctionCallInfoData structure

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: why declare arg as a array in FunctionCallInfoData structure
Дата
Msg-id 20090202083339.GA2610@svana.org
обсуждение исходный текст
Ответ на why declare arg as a array in FunctionCallInfoData structure  ("Tao Ma" <feng_eden@163.com>)
Список pgsql-hackers
On Mon, Feb 02, 2009 at 03:16:01PM +0800, Tao Ma wrote:
> hi,
>
> When I read the postgresql codes, I noticed that the FunctionCallInfoData
> structure(declared in the src/include/fmgr.h) contains two arrays 'arg' and
> 'argnull'.
> Why don't you declare it as a pointer and allocate the memory from heap? It
> saves more momery if 'arg' and 'argnull' declares as pointer type.

I imagaine it's because most of the time this structure would be
allocated on the stack, where allocation is essentially free. Having to
allocate two arrays from the heap would be slower.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

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

Предыдущее
От: "Tao Ma"
Дата:
Сообщение: why declare arg as a array in FunctionCallInfoData structure
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: why declare arg as a array in FunctionCallInfoData structure