Re: [COMMITTERS] pgsql: Add new function dsa_allocate0.

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Add new function dsa_allocate0.
Date: 2017-02-18 23:27:59
Message-ID: CAEepm=0O3VWhGN+_TM0-LzBtVpoY1w5w_p7aqtT+ykRGszFqrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Sun, Feb 19, 2017 at 11:27 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
>> On Sat, Feb 18, 2017 at 5:41 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>>> I'm thinking we should change this to look more like the
>>>> MemoryContextAlloc interface.
>
>>> +1
>
>> Maybe something like the attached? I didn't add DSA_ALLOC_HUGE
>> because there is currently no limit on allocation size (other than the
>> limit on total size which you can set with dsa_set_size_limit, but
>> that causes allocation failure, not a separate kind of error). Should
>> there be a per-allocation size sanity check of 1GB like palloc?
>
> I think it's not a bad idea. It could help catch faulty allocation
> requests (since I'd bet very few call sites actually intend to allocate
> gigabytes in one go), and as Robert says, there is substantial value in
> the semantics being as much like palloc() as possible. People are
> likely to assume that even if it isn't true.

Agreed. Here's a patch like that.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
dsa-extended-v2.patch application/octet-stream 5.5 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2017-02-18 23:31:42 Re: [COMMITTERS] pgsql: Add new function dsa_allocate0.
Previous Message Tom Lane 2017-02-18 22:27:42 Re: [COMMITTERS] pgsql: Add new function dsa_allocate0.

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2017-02-18 23:31:42 Re: [COMMITTERS] pgsql: Add new function dsa_allocate0.
Previous Message Stephen Frost 2017-02-18 23:08:33 Re: Allow pg_dumpall to work without pg_authid