Re: Why not use the calloc to replace malloc?

Поиск
Список
Период
Сортировка
От Thorsten Glaser
Тема Re: Why not use the calloc to replace malloc?
Дата
Msg-id 41c9d7f-7953-d22c-12f1-e83815cb5d9e@evolvis.org
обсуждение исходный текст
Ответ на Re: Why not use the calloc to replace malloc?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Why not use the calloc to replace malloc?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Sat, 22 Apr 2023, Tom Lane wrote:

>Wen Yi <chuxuec@outlook.com> writes:
>> [ use calloc to replace zeroing fields individually ]
[…]
>People have complained about this practice off-and-on, but no one has
>provided any evidence that there's a significant performance cost.
>The maintenance benefits are real though.

Oh, interesting ;-) Thanks for this explanation.

Another data point is: calloc is not correct for pointer fields,
you have to manually assign NULL to them afterwards still, because
NULL doesn’t have to be represented by all-zero bytes (e.g. TenDRA
supports having 0x55555555 as NULL pointer as an option).

bye,
//mirabilos
--
15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why not use the calloc to replace malloc?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Why not use the calloc to replace malloc?