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

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [COMMITTERS] pgsql: Create libpgcommon, and move pg_malloc et al to it
Date: 2013-02-14 08:25:07
Message-ID: 511C9F63.1020702@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers 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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2013-02-14 15:53:07 pgsql: pg_upgrade: conditionally create cluster delete script
Previous Message Bruce Momjian 2013-02-14 05:04:21 pgsql: Fix pg_upgrade log file cleanup code

Browse pgsql-hackers by date

  From Date Subject
Next Message Shigeru Hanada 2013-02-14 09:13:28 Re: FDW for PostgreSQL
Previous Message Pavel Stehule 2013-02-14 07:25:27 Re: proposal or just idea for psql - show first N rows from relation backslash statement