Re: inline newNode()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: inline newNode()
Date: 2002-10-09 04:28:32
Message-ID: 17106.1034137712@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-10-09 04:35:06 Re: inline newNode()
Previous Message Bruce Momjian 2002-10-09 04:21:41 Re: inline newNode()

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-10-09 04:35:06 Re: inline newNode()
Previous Message Bruce Momjian 2002-10-09 04:21:41 Re: inline newNode()