Re: Shared memory

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Natarajan R <nataraj3098(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Shared memory
Date: 2019-10-07 13:09:32
Message-ID: CA+TgmoaV16XMnLH7vE2Dph_SqZK3iUfNOYRdfXHf7UqfL7q=mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 4, 2019 at 5:51 AM Natarajan R <nataraj3098(at)gmail(dot)com> wrote:
> Why postgres not providing freeing shared memory?

Because it's intended to be used mostly for data structures that live
for the entire server lifetime.

There are some cases, such as various hash tables, where the number of
entries can grow and shrink over time. It might be useful to return
memory that is freed up when the hash table shrinks to the common
pool, but it would be complex, because then we'd have to keep track of
multiple chunks of freed memory and consolidate adjacent chunks and so
forth. I don't see that we'd be likely to get much benefit from such a
system, since a lot of cases memory fragmentation would prevent us
from getting any real benefit.

If you need a shared data structure that is temporary, you might want
to check out DSM and DSA.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2019-10-07 13:13:56 Re: Standby accepts recovery_target_timeline setting?
Previous Message Robert Haas 2019-10-07 13:05:34 Re: WIP/PoC for parallel backup