Re: Add bump memory context type and use it for tuplesorts
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Amul Sul <sulamul@gmail.com>
Cc: Daniel Gustafsson <daniel@yesql.se>, Andres Freund <andres@anarazel.de>,
Tom Lane <tgl@sss.pgh.pa.us>, Tomas Vondra <tomas.vondra@enterprisedb.com>,
John Naylor <johncnaylorls@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2024-04-16T10:14:13Z
Lists: pgsql-hackers
Attachments
- v2-Add-BumpContext-description-to-mmgr-README.patch (text/plain) patch v2
On Tue, 16 Apr 2024 at 17:13, Amul Sul <sulamul@gmail.com> wrote: > Attached is a small patch adding the missing BumpContext description to the > README. Thanks for noticing and working on the patch. There were a few things that were not quite accurate or are misleading: 1. > +These three memory contexts aim to free memory back to the operating system That's not true for bump. It's the worst of the 4. Worse than aset. It only returns memory when the context is reset/deleted. 2. "These memory contexts were initially developed for ReorderBuffer, but may be useful elsewhere as long as the allocation patterns match." The above isn't true for bump. It was written for tuplesort. I think we can just remove that part now. Slab and generation are both old enough not to care why they were conceived. Also since adding bump, I think the choice of which memory context to use is about 33% harder than it used to be when there were only 3 context types. I think this warrants giving more detail on what these 3 special-purpose memory allocators are good for. I've added more details in the attached patch. This includes more details about freeing malloc'd blocks I've tried to detail out enough of the specialities of the context type without going into extensive detail. My hope is that there will be enough detail for someone to choose the most suitable looking one and head over to the corresponding .c file to find out more. Is that about the right level of detail? David
Commits
-
Update mmgr's README to mention BumpContext
- 58cf2e120e8a 17.0 landed
-
Push dedicated BumpBlocks to the tail of the blocks list
- 6d2fd66b9908 17.0 landed
-
Improve test coverage in bump.c
- bea97cd02ebb 17.0 cited
-
Fix incorrect KeeperBlock macro in bump.c
- 705ec0565371 17.0 landed
-
Use bump memory context for tuplesorts
- 6ed83d5fa55c 17.0 landed
-
Introduce a bump memory allocator
- 29f6a959cfd8 17.0 landed
-
Enlarge bit-space for MemoryContextMethodID
- 0ba8b75e7ea6 17.0 landed