Re: [COMMITTERS] pgsql: Create libpgcommon, and move pg_malloc et al to it - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: [COMMITTERS] pgsql: Create libpgcommon, and move pg_malloc et al to it
Date
Msg-id 511C9F63.1020702@vmware.com
Whole thread Raw
List pgsql-hackers
On 12.02.2013 16:55, Alvaro Herrera wrote:
> Create libpgcommon, and move pg_malloc et al to it
>
> libpgcommon is a new static library to allow sharing code among the
> various frontend programs and backend; this lets us eliminate duplicate
> implementations of common routines.  We avoid libpgport, because that's
> intended as a place for porting issues; per discussion, it seems better
> to keep them separate.
>
> The first use case, and the only implemented by this patch, is pg_malloc
> and friends, which many frontend programs were already using.
>
> At the same time, we can use this to provide palloc emulation functions
> for the frontend; this way, some palloc-using files in the backend can
> also be used by the frontend cleanly.  To do this, we change palloc() in
> the backend to be a function instead of a macro on top of
> MemoryContextAlloc().  This was previously believed to cause loss of
> performance, but this implementation has been tweaked by Tom and Andres
> so that on modern compilers it provides a slight improvement over the
> previous one.

The new header file, fe_memutils.h, is not installed anywhere by "make 
install". That makes #include "postgres_fe.h" to fail in any program 
compiled out-of-tree, with pgxs.

Where should it be installed? postgres_fe.h and port.h are installed to 
include/internal, so that would seem logical. I wonder what the 
"internal" actually means there, though. If we want to encourage 
frontend programs to use these, "internal" doesn't sound right.

- Heikki



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal or just idea for psql - show first N rows from relation backslash statement
Next
From: Shigeru Hanada
Date:
Subject: Re: FDW for PostgreSQL