Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1b0d9aa

Browse files
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.com
1 parentcc58eec commit1b0d9aa

File tree

4 files changed

+325
-77
lines changed

4 files changed

+325
-77
lines changed

‎src/backend/access/gist/gistvacuum.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,15 @@ gistvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
158158
* pages in page_set_context. Internally, the integer set will remember
159159
* this context so that the subsequent allocations for these integer sets
160160
* will be done from the same context.
161+
*
162+
* XXX the allocation sizes used below pre-date generation context's block
163+
* growing code. These values should likely be benchmarked and set to
164+
* more suitable values.
161165
*/
162166
vstate.page_set_context=GenerationContextCreate(CurrentMemoryContext,
163167
"GiST VACUUM page set context",
168+
16*1024,
169+
16*1024,
164170
16*1024);
165171
oldctx=MemoryContextSwitchTo(vstate.page_set_context);
166172
vstate.internal_page_set=intset_create();

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,15 @@ ReorderBufferAllocate(void)
370370
SLAB_DEFAULT_BLOCK_SIZE,
371371
sizeof(ReorderBufferTXN));
372372

373+
/*
374+
* XXX the allocation sizes used below pre-date generation context's block
375+
* growing code. These values should likely be benchmarked and set to
376+
* more suitable values.
377+
*/
373378
buffer->tup_context=GenerationContextCreate(new_ctx,
374379
"Tuples",
380+
SLAB_LARGE_BLOCK_SIZE,
381+
SLAB_LARGE_BLOCK_SIZE,
375382
SLAB_LARGE_BLOCK_SIZE);
376383

377384
hash_ctl.keysize=sizeof(TransactionId);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp