Re: Fix redundant memset after palloc0 in heap_form_minimal_tuple()

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix redundant memset after palloc0 in heap_form_minimal_tuple()
Date: 2025-11-04 17:51:18
Message-ID: 60d84fcbb1ff31bcb7497a632ace36fdd59b2168.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2025-11-04 at 17:05 +0800, Chao Li wrote:
> The current code does both palloc0() and memset(0)
> in heap_form_minimal_tuple():

Thank you, fixed.

> To fix the problem, my first impression was to delete the memset().
> But looking at a0942f4, I found a couple of other places that do the
> same pattern: palloc(len+extra) then memset(0, extra), so I think the
> correct fix should be changing the palloc0 to palloc.

The palloc0() is important because heap_fill_tuple() skips over
alignment bytes. So I just removed the memset().

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-11-04 17:52:19 pg_utility ?
Previous Message Álvaro Herrera 2025-11-04 17:37:14 Re: BRIN autosummarization lacking a snapshot