PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "lib/ilist.h"
#include "port/pg_bitutils.h"
#include "utils/memdebug.h"
#include "utils/memutils.h"
#include "utils/memutils_memorychunk.h"
#include "utils/memutils_internal.h"
Go to the source code of this file.
Data Structures | |
struct | BumpContext |
struct | BumpBlock |
Macros | |
#define | Bump_BLOCKHDRSZ MAXALIGN(sizeof(BumpBlock)) |
#define | Bump_CHUNKHDRSZ 0 |
#define | Bump_CHUNK_FRACTION 8 |
#define | KeeperBlock(set) |
#define | IsKeeperBlock(set, blk) (KeeperBlock(set) == (blk)) |
#define | BumpIsValid(set) (PointerIsValid(set) && IsA(set, BumpContext)) |
#define | ExternalChunkGetBlock(chunk) (BumpBlock *) ((char *) chunk - Bump_BLOCKHDRSZ) |
Typedefs | |
typedef struct BumpBlock | BumpBlock |
typedef struct BumpContext | BumpContext |
#define BumpIsValid | ( | set | ) | (PointerIsValid(set) && IsA(set, BumpContext)) |
#define ExternalChunkGetBlock | ( | chunk | ) | (BumpBlock *) ((char *) chunk - Bump_BLOCKHDRSZ) |
#define IsKeeperBlock | ( | set, | |
blk | |||
) | (KeeperBlock(set) == (blk)) |
#define KeeperBlock | ( | set | ) |
typedef struct BumpContext BumpContext |
void* BumpAlloc | ( | MemoryContext | context, |
Size | size, | ||
int | flags | ||
) |
Definition at line 491 of file bump.c.
References BumpContext::allocChunkLimit, Assert, BumpContext::blocks, Bump_CHUNKHDRSZ, BumpAllocChunkFromBlock(), BumpAllocFromNewBlock(), BumpAllocLarge(), BumpBlockFreeBytes(), BumpIsValid, context, dlist_container, dlist_head_node(), MAXALIGN, and size.
|
inlinestatic |
Definition at line 371 of file bump.c.
References Assert, Bump_CHUNKHDRSZ, chunk, BumpBlock::endptr, BumpBlock::freeptr, MCTX_BUMP_ID, MemoryChunkGetPointer, MemoryChunkSetHdrMask(), size, VALGRIND_MAKE_MEM_NOACCESS, and VALGRIND_MAKE_MEM_UNDEFINED.
Referenced by BumpAlloc(), and BumpAllocFromNewBlock().
|
static |
Definition at line 430 of file bump.c.
References BumpContext::blocks, Bump_BLOCKHDRSZ, Bump_CHUNKHDRSZ, BumpAllocChunkFromBlock(), BumpBlockInit(), context, dlist_push_head(), malloc, BumpContext::maxBlockSize, MemoryContextAllocationFailure(), BumpContext::nextBlockSize, BumpBlock::node, pg_nextpower2_size_t, and size.
Referenced by BumpAlloc().
|
static |
Definition at line 293 of file bump.c.
References Assert, BumpContext::blocks, Bump_BLOCKHDRSZ, Bump_CHUNKHDRSZ, chunk, context, dlist_push_tail(), BumpBlock::endptr, BumpBlock::freeptr, malloc, MAXALIGN, MCTX_BUMP_ID, MemoryChunkGetPointer, MemoryChunkSetHdrMaskExternal(), MemoryContextCheckSize(), BumpBlock::node, size, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by BumpAlloc().
|
inlinestatic |
Definition at line 595 of file bump.c.
References Assert, dlist_delete(), BumpBlock::endptr, free, IsKeeperBlock, and BumpBlock::node.
Referenced by BumpReset().
Definition at line 585 of file bump.c.
References BumpBlock::endptr, and BumpBlock::freeptr.
Referenced by BumpAlloc().
|
inlinestatic |
Definition at line 535 of file bump.c.
References Bump_BLOCKHDRSZ, context, BumpBlock::endptr, BumpBlock::freeptr, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by BumpAllocFromNewBlock(), and BumpContextCreate().
|
inlinestatic |
Definition at line 552 of file bump.c.
References Bump_BLOCKHDRSZ, and BumpBlock::freeptr.
Referenced by BumpIsEmpty().
|
inlinestatic |
Definition at line 563 of file bump.c.
References Bump_BLOCKHDRSZ, BumpBlock::freeptr, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by BumpReset().
MemoryContext BumpContextCreate | ( | MemoryContext | parent, |
const char * | name, | ||
Size | minContextSize, | ||
Size | initBlockSize, | ||
Size | maxBlockSize | ||
) |
Definition at line 131 of file bump.c.
References BumpContext::allocChunkLimit, AllocHugeSizeIsValid, Assert, BumpContext::blocks, Bump_BLOCKHDRSZ, Bump_CHUNK_FRACTION, Bump_CHUNKHDRSZ, BumpBlockInit(), dlist_init(), dlist_push_head(), ereport, errcode(), errdetail(), errmsg(), ERROR, BumpContext::initBlockSize, KeeperBlock, malloc, Max, MAXALIGN, BumpContext::maxBlockSize, MCTX_BUMP_ID, MEMORYCHUNK_MAX_BLOCKOFFSET, MEMORYCHUNK_MAX_VALUE, MemoryContextCreate(), MemoryContextStats(), Min, name, BumpContext::nextBlockSize, BumpBlock::node, StaticAssertDecl, and TopMemoryContext.
Referenced by TidStoreCreateLocal(), and tuplesort_begin_batch().
void BumpDelete | ( | MemoryContext | context | ) |
void BumpFree | ( | void * | pointer | ) |
MemoryContext BumpGetChunkContext | ( | void * | pointer | ) |
Size BumpGetChunkSpace | ( | void * | pointer | ) |
bool BumpIsEmpty | ( | MemoryContext | context | ) |
Definition at line 660 of file bump.c.
References Assert, BumpContext::blocks, BumpBlockIsEmpty(), BumpIsValid, context, dlist_iter::cur, dlist_container, and dlist_foreach.
void* BumpRealloc | ( | void * | pointer, |
Size | size, | ||
int | flags | ||
) |
void BumpReset | ( | MemoryContext | context | ) |
Definition at line 243 of file bump.c.
References Assert, BumpContext::blocks, BumpBlockFree(), BumpBlockMarkEmpty(), BumpIsValid, context, dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, dlist_has_next(), dlist_head_node(), dlist_is_empty(), BumpContext::initBlockSize, IsKeeperBlock, and BumpContext::nextBlockSize.
Referenced by BumpDelete().
void BumpStats | ( | MemoryContext | context, |
MemoryStatsPrintFunc | printfunc, | ||
void * | passthru, | ||
MemoryContextCounters * | totals, | ||
bool | print_to_stderr | ||
) |
Definition at line 688 of file bump.c.
References Assert, BumpContext::blocks, BumpIsValid, context, dlist_iter::cur, dlist_container, dlist_foreach, BumpBlock::endptr, BumpBlock::freeptr, MemoryContextCounters::freespace, MemoryContextCounters::nblocks, snprintf, and MemoryContextCounters::totalspace.