Re: [PATCH] Use MemoryContextAlloc() in the MemoryContextAllocZero() and MemoryContextAllocZeroAligned()

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alexander Kuleshov <kuleshovmail(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Use MemoryContextAlloc() in the MemoryContextAllocZero() and MemoryContextAllocZeroAligned()
Date: 2016-03-12 08:50:10
Message-ID: CAB7nPqT=6EFKbnu5GuJFiH2qS1KUhTSeVUrJovKF7unoD4i6Wg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 12, 2016 at 8:09 AM, Alexander Kuleshov
<kuleshovmail(at)gmail(dot)com> wrote:
> Hello all,
>
> Attached patch simplifies the MemoryContextAllocZero() and
> MemoryContextAllocZeroAligned().
> The MemoryContextAllocZero() and MemoryContextAllocZeroAligned()
> functions does almost the
> same that MemoryContextAlloc() does. Additionally these functions
> fills allocated memory context
> with zeros via MemSetAligned() and MemSetLoop(). Let's call
> MemoryContextAlloc() in these functions
> instead of setting isReset to false, call alloc() callback of the
> context and etc., to prevent code duplication.

This code duplication is on purpose. This is a very hot code path and
we want to avoid the overhead of an extra function call.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2016-03-12 09:02:55 Re: Explain [Analyze] produces parallel scan for select Into table statements.
Previous Message Mithun Cy 2016-03-12 08:32:04 Re: Explain [Analyze] produces parallel scan for select Into table statements.