Re: inline newNode() - Mailing list pgsql-patches

From Tom Lane
Subject Re: inline newNode()
Date
Msg-id 17106.1034137712@sss.pgh.pa.us
Whole thread Raw
In response to Re: inline newNode()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: inline newNode()  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Right, palloc shouldn't.  I was thinking of having another version of
> palloc that _does_ clear out memory, and calling that from a newNode()
> macro.  We already know palloc is going to call MemoryContextAlloc, so
> we could have a pallocC() that calls a new MemoryContextAllocC() that
> would call the underlying memory allocation function, then do the loop
> like MemSet to clear it.

But if the MemSet is inside the called function then it cannot reduce
the if-tests to a compile-time decision to invoke the word-zeroing loop.
We want the MemSet to be expanded at the newNode call site, where the
size of the allocated memory is a compile-time constant.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: inline newNode()
Next
From: Bruce Momjian
Date:
Subject: Re: inline newNode()