Re: Dynamic shared memory areas - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Dynamic shared memory areas
Date
Msg-id CA+TgmoZpSA21XUykhYb8mpO5t97=vxHeaAEobFawHgnkMrJMXg@mail.gmail.com
Whole thread Raw
In response to Re: Dynamic shared memory areas  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: Dynamic shared memory areas  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Nov 23, 2016 at 7:07 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Those let you create an area in existing memory (in a DSM segment,
> traditional inherited shmem).  The in-place versions will stlll create
> DSM segments on demand as required, though I suppose if you wanted to
> prevent that you could with dsa_set_size_limit(area, size).  One
> complication is that of course the automatic detach feature doesn't
> work if you're in some random piece of memory.  I have exposed
> dsa_on_dsm_detach, so that there is a way to hook it up to the detach
> hook for a pre-existing DSM segment, but that's the caller's
> responibility.

shm_mq_attach() made the opposite decision about how to solve this
problem, and frankly I think that API is a lot more convenient: if the
first argument to shm_mq_attach() happens to be located inside of a
DSM, you can pass the DSM as the second argument and it registers the
on_dsm_detach() hook for you.  If not, you can pass NULL and deal with
it in some other way.  But this makes the common case very simple.

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



pgsql-hackers by date:

Previous
From: Nico Williams
Date:
Subject: Re: Tackling JsonPath support
Next
From: Alvaro Herrera
Date:
Subject: Re: Fix comment in build_simple_rel