Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)

From: David Zhang <david(dot)zhang(at)highgo(dot)ca>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)
Date: 2022-08-19 22:27:04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Ranier,

Following the comment in commit 9fd45870c1436b477264c0c82eb195df52bc0919,

    (The same could be done with appropriate memset() calls, but this
    patch is part of an effort to phase out MemSet(), so it doesn't touch
    memset() calls.)

Should these obviously possible replacement of the standard library
function "memset" be considered as well? For example, something like the
attached one which is focusing on the pageinspect extension only.

Best regards,


On 2022-08-01 10:08 a.m., Ranier Vilela wrote:
> Em sáb., 16 de jul. de 2022 às 16:54, Ranier Vilela
> <ranier(dot)vf(at)gmail(dot)com> escreveu:
> Em sáb, 16 de jul de 2022 2:58 AM, Peter Eisentraut
> <peter(dot)eisentraut(at)enterprisedb(dot)com> escreveu:
> On 11.07.22 21:06, Ranier Vilela wrote:
> > Em qui., 7 de jul. de 2022 às 14:01, Ranier Vilela
> <ranier(dot)vf(at)gmail(dot)com
> > <mailto:ranier(dot)vf(at)gmail(dot)com>> escreveu:
> >
> >     Attached the v1 of your patch.
> >     I think that all is safe to switch MemSet by {0}.
> >
> > Here the rebased patch v2, against latest head.
> I have committed my patch with Álvaro's comments addressed
> I see.
> It's annoing that old compiler (gcc 4.7.2) don't handle this style.
> Your patch appears to add in changes that are either arguably
> out of
> scope or would need further review (e.g., changing memset()
> calls,
> changing the scope of some variables, changing places that
> need to worry
> about padding bits).  Please submit separate patches for
> those, and we
> can continue the analysis.
> Sure.
> Hi, sorry for the delay.
> Like how
> New attempt to remove more MemSet calls, that are safe.
> Attached v3 patch.
> regards,
> Ranier Vilela

Attachment Content-Type Size
0001-Replace-many-memset-calls-with-struct-initialization.patch text/plain 5.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-08-19 22:28:14 Re: use ARM intrinsics in pg_lfind32() where available
Previous Message Andres Freund 2022-08-19 21:26:02 Re: use ARM intrinsics in pg_lfind32() where available