| From: | Souvik Bhattacherjee <kivuosb(at)gmail(dot)com> |
|---|---|
| To: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Allocating shared memory in Postgres |
| Date: | 2019-07-03 20:06:50 |
| Message-ID: | CAANrPScpwLXFs0FmEXMk5CZRpXUt5q2uL7Ac++oXBujEJ5xzfA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
I need to allocate shared memory in Postgres 11.0 outside the
initialization phase. In order to achieve this I have done the following:
- increased the amount of shared memory by increasing the value of size in
CreateSharedMemoryAndSemaphores (int port) in ipci.c. I have made sure that
the amount of memory that I need, say m << M, where M is the amount of
additional shared memory that I have allocated.
- during a particular query, where I need to allocate shared memory (which
is a function of the sizes of the tables in the query), I invoke
ShmemInitStruct() in shmem.c
This seems to work in my case, although I haven't tested it extensively.
My concern here is that when I go through the NOTES in shmem.c, I find the
following line:
Fixed-size structures contain things like global variables for a module and
should never be allocated after the shared memory initialization phase.
I'm allocating a shared array data structure through ShmemInitStruct and
I'm not sure if the lines above apply to my case, since I'm doing the
allocation during a query.
Any help/clarifications in this regard would be appreciated.
Best,
-SB
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2019-07-03 20:17:37 | Re: Allocating shared memory in Postgres |
| Previous Message | Tom Lane | 2019-07-03 19:36:56 | Re: postgres 11 issue? |