Re: dynamically allocating chunks from shared memory

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: dynamically allocating chunks from shared memory
Дата
Msg-id AANLkTik6S7LCfCr72odSo0rUbXfms-pSFxzEP3b9jbkX@mail.gmail.com
обсуждение исходный текст
Ответ на Re: dynamically allocating chunks from shared memory  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: dynamically allocating chunks from shared memory  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
On Mon, Aug 9, 2010 at 12:31 PM, Bruce Momjian <bruce@momjian.us> wrote:
> Bruce Momjian wrote:
>> > With our process-based design, the default is private memory (i.e. not
>> > shared). If you need shared memory, you must specify a certain amount in
>> > advance. That chunk of shared memory then is reserved and can't ever be
>> > used by another subsystem. Even if you barely ever need that much shared
>> > memory for the subsystem in question.
>>
>> Once multiple threads are using the same local memory, you have the same
>> issues of being unable to resize it because repalloc can change the
>> pointer location.
>
> Let me be more concrete.  Suppose you are using threads, and you want to
> increase your shared memory from 20MB to 30MB.  How do you do that?  If
> you want it contiguous, you have to use realloc, which might move the
> pointer.  If you allocate another 10MB chunk, you then have shared
> memory fragments, which is the same as adding another shared memory
> segment.

You probably wouldn't do either of those things.  You'd just allocate
small chunks here and there for whatever you need them for.

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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: dynamically allocating chunks from shared memory
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Surprising dead_tuple_count from pgstattuple