From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Markus Wanner <markus(at)bluegap(dot)ch>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: dynamically allocating chunks from shared memory |
Date: | 2010-08-09 18:33:54 |
Message-ID: | 201008091833.o79IXsh11280@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Robert Haas wrote:
> On Mon, Aug 9, 2010 at 12:31 PM, Bruce Momjian <bruce(at)momjian(dot)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.
Well, then we do that with shared memory then --- my point is that it is
the same problem with threads or processes.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2010-08-09 18:34:22 | Re: dynamically allocating chunks from shared memory |
Previous Message | Bruce Momjian | 2010-08-09 18:33:08 | Re: dynamically allocating chunks from shared memory |