Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqabJ-00033Z-2I for pgsql-general@arkaria.postgresql.org; Sun, 23 Apr 2023 14:22:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pqabF-0005zH-LM for pgsql-general@arkaria.postgresql.org; Sun, 23 Apr 2023 14:21:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqabF-0005yx-AH for pgsql-general@lists.postgresql.org; Sun, 23 Apr 2023 14:21:57 +0000 Received: from evolvis.org ([2a02:a00:2000:f::1]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pqab9-004cpE-4k for pgsql-general@lists.postgresql.org; Sun, 23 Apr 2023 14:21:56 +0000 Received: from x61w.mirbsd.org (2001-4dd7-40a3-0-21f-3bff-fe0d-cbb1.ipv6dyn.netcologne.de [IPv6:2001:4dd7:40a3:0:21f:3bff:fe0d:cbb1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by evolvis.org (Postfix) with ESMTPSA id 11F41100218; Sun, 23 Apr 2023 14:21:49 +0000 (UTC) Received: by x61w.mirbsd.org (Postfix, from userid 1000) id 34B8563480; Sun, 23 Apr 2023 16:21:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by x61w.mirbsd.org (Postfix) with ESMTP id 1976960723; Sun, 23 Apr 2023 16:21:48 +0200 (CEST) Date: Sun, 23 Apr 2023 16:21:48 +0200 (CEST) From: Thorsten Glaser To: pgsql-general@lists.postgresql.org cc: Wen Yi Subject: Re: Why not use the calloc to replace malloc? In-Reply-To: <3765291.1682222377@sss.pgh.pa.us> Message-ID: <41c9d7f-7953-d22c-12f1-e83815cb5d9e@evolvis.org> References: <3765291.1682222377@sss.pgh.pa.us> Content-Language: de-DE-1901 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 22 Apr 2023, Tom Lane wrote: >Wen Yi writes: >> [ use calloc to replace zeroing fields individually ] [=E2=80=A6] >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=E2=80=99t have to be represented by all-zero bytes (e.g. TenDRA supports having 0x55555555 as NULL pointer as an option). bye, //mirabilos --=20 15:41=E2=8E=9C Somebody write a testsuite for hello= world :-)