Allocating shared memory in Postgres
От | Souvik Bhattacherjee |
---|---|
Тема | Allocating shared memory in Postgres |
Дата | |
Msg-id | CAANrPScpwLXFs0FmEXMk5CZRpXUt5q2uL7Ac++oXBujEJ5xzfA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Allocating shared memory in Postgres
|
Список | 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
В списке pgsql-general по дате отправления: