extension allocating shared memory

Started by Kevin Grittnerover 13 years ago3 messages
#1Kevin Grittner
Kevin.Grittner@wicourts.gov

What is the best way for an extension to allocate shared memory and to
access it from every backend? Or, if there is no support existing for
that, what advice do people have if I want to make that happen? I don't
need a lot (probably 1KB would do).

If this just "can't be done" I guess I could start a little daemon to
run alongside PostgreSQL and talk to it through a pipe or TCP on
localhost, but it seems cleaner to have it run within PostgreSQL if
feasible.

-Kevin

#2Alvaro Herrera
alvherre@commandprompt.com
In reply to: Kevin Grittner (#1)
Re: extension allocating shared memory

Excerpts from Kevin Grittner's message of mar abr 17 16:27:21 -0300 2012:

What is the best way for an extension to allocate shared memory and to
access it from every backend? Or, if there is no support existing for
that, what advice do people have if I want to make that happen? I don't
need a lot (probably 1KB would do).

RequestAddinShmemSpace

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#3Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Alvaro Herrera (#2)
Re: extension allocating shared memory

Alvaro Herrera <alvherre@commandprompt.com> wrote:

Excerpts from Kevin Grittner's message:

What is the best way for an extension to allocate shared memory
and to access it from every backend?

RequestAddinShmemSpace

Perfect! That's exactly what I wanted. I see that the
pg_stat_statements extension is already using it, so I even have a
good working example to look at.

Thanks,

-Kevin