diff --git a/src/backend/utils/mmgr/bump.c b/src/backend/utils/mmgr/bump.c index 449bd29344..a98bafbcc0 100644 --- a/src/backend/utils/mmgr/bump.c +++ b/src/backend/utils/mmgr/bump.c @@ -342,8 +342,12 @@ BumpAllocLarge(MemoryContext context, Size size, int flags) randomize_mem((char *) MemoryChunkGetPointer(chunk), size); #endif - /* add the block to the list of allocated blocks */ - dlist_push_head(&set->blocks, &block->node); + /* + * Add the block to the tail of allocated blocks list. The current block + * is left at the head of the list as it may still have space for + * non-large allocations. + */ + dlist_push_tail(&set->blocks, &block->node); #ifdef MEMORY_CONTEXT_CHECKING /* Ensure any padding bytes are marked NOACCESS. */ @@ -612,7 +616,7 @@ BumpBlockFree(BumpContext *set, BumpBlock *block) void BumpFree(void *pointer) { - elog(ERROR, "pfree is not supported by the bump memory allocator"); + elog(ERROR, "%s is not supported by the bump memory allocator", "pfree"); } /* @@ -638,10 +642,9 @@ BumpGetChunkContext(void *pointer) } /* -* BumpGetChunkSpace -* Given a currently-allocated chunk, determine the total space -* it occupies (including all memory-allocation overhead). -*/ + * BumpGetChunkSpace + * Unsupported. + */ Size BumpGetChunkSpace(void *pointer) { diff --git a/src/test/regress/expected/sysviews.out b/src/test/regress/expected/sysviews.out index 634dc8d8b8..2f3eb4e7f1 100644 --- a/src/test/regress/expected/sysviews.out +++ b/src/test/regress/expected/sysviews.out @@ -47,7 +47,7 @@ select name, parent, total_bytes > 0, total_nblocks, free_bytes > 0, free_chunks from pg_backend_memory_contexts where name = 'Caller tuples'; name | parent | ?column? | total_nblocks | ?column? | free_chunks ---------------+----------------+----------+---------------+----------+------------- - Caller tuples | TupleSort sort | t | 3 | t | 0 + Caller tuples | TupleSort sort | t | 2 | t | 0 (1 row) rollback;