On Fri, Jun 17, 2016 at 11:30 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Aleksey Demakov <adema...@gmail.com> writes: >> I have some very experimental code to enable dynamic memory allocation >> of shared memory for postgresql backend processes. > > Um ... what's this do that the existing DSM stuff doesn't do?
It seems to be a full-fledged allocator, rather than just a way of getting a slab of bytes from the operating system. Think malloc() rather than sbrk(). But I'm a bit confused about where it gets the bytes it wants to manage. There's no call to dsm_create() or ShmemAlloc() anywhere in the code, at least not that I could find quickly. The only way to get shar_base set to a non-NULL value seems to be to call SharAttach(), and if there's no SharCreate() where would we get that non-NULL value? EnterpriseDB is working on a memory allocator which will manage chunks of dynamic shared memory and provide an allocate/free interface to allow small allocations to be carved out of large DSM segments: https://wiki.postgresql.org/wiki/EnterpriseDB_database_server_roadmap I expect that to be useful for parallel query and anything else where processes need to share variable-size data. However, that's different from this because ours can grown to arbitrary size and shrink again by allocating and freeing with DSM segments. We also do everything with relative pointers since DSM segments can be mapped at different addresses in different processes, whereas this would only work with memory carved out of the main shared memory segment (or some new DSM facility that guaranteed identical placement in every address space). I expect we'll probably post our implementation of this shortly after 9.7 development opens. I've been a bit reluctant to put it out there until we have a tangible application of the allocator working, for fear people will say "that's not good for anything!". I'm confident it's good for lots of things, but other people have been known not to share my confidence. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers