forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1b0d9aa
committed
Improve the generation memory allocator
Here we make a series of improvements to the generation memoryallocator, namely:1. Allow generation contexts to have a minimum, initial and maximum blocksizes. The standard allocator allows this already but when the generationcontext was added, it only allowed fixed-sized blocks. The problem withfixed-sized blocks is that it's difficult to choose how large to make theblocks. If the chosen size is too small then we'd end up with a largenumber of blocks and a large number of malloc calls. If the block size ismade too large, then memory is wasted.2. Add support for "keeper" blocks. This is a special block that isallocated along with the context itself but is never freed. Instead,when the last chunk in the keeper block is freed, we simply mark the blockas empty to allow new allocations to make use of it.3. Add facility to "recycle" newly empty blocks instead of freeing themand having to later malloc an entire new block again. We do this byrecording a single GenerationBlock which has become empty of any chunks.When we run out of space in the current block, we check to see if there isa "freeblock" and use that if it contains enough space for the allocation.Author: David Rowley, Tomas VondraReviewed-by: Andy FanDiscussion:https://postgr.es/m/d987fd54-01f8-0f73-af6c-519f799a0ab8@enterprisedb.com1 parentcc58eec commit1b0d9aa
File tree
4 files changed
+325
-77
lines changed- src
- backend
- access/gist
- replication/logical
- utils/mmgr
- include/utils
4 files changed
+325
-77
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
158 | 158 |
| |
159 | 159 |
| |
160 | 160 |
| |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
161 | 165 |
| |
162 | 166 |
| |
163 | 167 |
| |
| 168 | + | |
| 169 | + | |
164 | 170 |
| |
165 | 171 |
| |
166 | 172 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
370 | 370 |
| |
371 | 371 |
| |
372 | 372 |
| |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
373 | 378 |
| |
374 | 379 |
| |
| 380 | + | |
| 381 | + | |
375 | 382 |
| |
376 | 383 |
| |
377 | 384 |
| |
|
0 commit comments
Comments
(0)