Re: Large writable variables

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Thomas Munro <thomas.munro@enterprisedb.com>
Date: 2018-10-16T19:13:43Z
Lists: pgsql-hackers
On Mon, Oct 15, 2018 at 4:08 PM Andres Freund <andres@anarazel.de> wrote:
> So we have 500kb of not-initialized memory mapped into every
> process. That's, uh, not nothing.

Thinking about this a bit more, why is this bad?  I mean, if the
memory is never touched, the OS does not really need to allocate or
zero any pages, or even make any page table entries.  If somebody
actually accesses the data, then we'll take a page fault and have to
really allocate, but otherwise I would think we could have 50MB of
unused bss floating around and it wouldn't really matter, let alone
500kB.

What am I missing?

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


Commits

  1. Apply unconstify() in more places

  2. Improve unconstify() documentation

  3. Drop const cast from dlsym() calls

  4. Const-ify a few more large static tables.

  5. Improve tzparse's handling of TZDEFRULES ("posixrules") zone data.

  6. Avoid statically allocating statement cache in ecpglib/prepare.c.

  7. Reorder FmgrBuiltin members, saving 25% in size.

  8. Add macro to cast away const without allowing changes to underlying type.

  9. Mark constantly allocated dest receiver as const.

  10. Avoid statically allocating formatting.c's format string caches.

  11. Correct constness of system attributes in heap.c & prerequisites.

  12. Avoid statically allocating gmtsub()'s timezone workspace.

  13. Correct constness of a few variables.

  14. Move the replication lag tracker into heap memory.