Re: Shared memory and memory context question - Mailing list pgsql-hackers

From Neil Conway
Subject Re: Shared memory and memory context question
Date
Msg-id 1139188156.9135.25.camel@localhost.localdomain
Whole thread Raw
In response to Shared memory and memory context question  (richard@playford.net)
List pgsql-hackers
On Sun, 2006-02-05 at 14:03 +0000, richard@playford.net wrote:
> 3. Somehow create shared memory using the shmem functions, and set a memory 
> context to live *inside* this shared memory, which my trigger functions can 
> then switch to. Then use palloc() and pfree() without worrying..

This has been done before, by the TelegraphCQ folks: they implemented a
shared memory MemoryContext on top of OSSP MM[1]. The code is in the
v0.2 TelegraphCQ tarball[2] -- see shmctx.c and shmset.c in
src/backend/utils/mmgr/. I'm not aware of an independent distribution,
but you could probably separate it out without too much pain.

(Of course, the comments elsewhere in the thread about using an
alternative are probably still true...)

-Neil

[1] http://www.ossp.org/pkg/lib/mm/
[2] http://telegraph.cs.berkeley.edu/downloads/TelegraphCQ-0.2.tar.gz



pgsql-hackers by date:

Previous
From: James William Pye
Date:
Subject: Re: Copy From & Insert UNLESS
Next
From: "Mark Woodward"
Date:
Subject: Re: Shared memory and memory context question