Re: Safe memory allocation functions

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Safe memory allocation functions
Date: 2015-01-17 14:06:40
Message-ID: CA+Tgmob56c=ifUq6O0dBQymqUSuvjmOgPg6fPsaytFJU57uQCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 16, 2015 at 10:56 AM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> So how about something like
>
> #define ALLOCFLAG_HUGE 0x01
> #define ALLOCFLAG_NO_ERROR_ON_OOM 0x02
> void *
> MemoryContextAllocFlags(MemoryContext context, Size size, int flags);

That sounds good, although personally I'd rather have the name be
something like MemoryContextAllocExtended; we have precedent for using
"Extended" for this sort of thing elsewhere. Also, I'd suggest trying
to keep the flag name short, e.g. ALLOC_HUGE and ALLOC_NO_OOM (or
ALLOC_SOFT_FAIL?).

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-01-17 14:16:30 Re: Error check always bypassed in tablefunc.c
Previous Message Andres Freund 2015-01-17 13:08:34 Re: moving from contrib to bin