From: Thorsten Glaser <tg@evolvis.org>
To: pgsql-general@lists.postgresql.org
Cc: Wen Yi <chuxuec@outlook.com>
Subject: Re: Why not use the calloc to replace malloc?
Date: Sun, 23 Apr 2023 16:21:48 +0200 (CEST)
Message-ID: <41c9d7f-7953-d22c-12f1-e83815cb5d9e@evolvis.org> (raw)
In-Reply-To: <3765291.1682222377@sss.pgh.pa.us>
References: <TYAP286MB0636A72D4EC3E52779FDB4F0A9669@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM>
<3765291.1682222377@sss.pgh.pa.us>
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 :-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tg@evolvis.org, chuxuec@outlook.com
Subject: Re: Why not use the calloc to replace malloc?
In-Reply-To: <41c9d7f-7953-d22c-12f1-e83815cb5d9e@evolvis.org>
References: <TYAP286MB0636A72D4EC3E52779FDB4F0A9669@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM> <3765291.1682222377@sss.pgh.pa.us> <41c9d7f-7953-d22c-12f1-e83815cb5d9e@evolvis.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox