Re: Shared memory - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Shared memory
Date
Msg-id CA+TgmoaV16XMnLH7vE2Dph_SqZK3iUfNOYRdfXHf7UqfL7q=mw@mail.gmail.com
Whole thread Raw
In response to Shared memory  (Natarajan R <nataraj3098@gmail.com>)
List pgsql-hackers
On Fri, Oct 4, 2019 at 5:51 AM Natarajan R <nataraj3098@gmail.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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: WIP/PoC for parallel backup
Next
From: Fujii Masao
Date:
Subject: Re: Standby accepts recovery_target_timeline setting?