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"
Go to the source code of this file.
Data Structures | |
struct | GenerationContext |
struct | GenerationBlock |
struct | GenerationChunk |
Macros | |
#define | Generation_BLOCKHDRSZ MAXALIGN(sizeof(GenerationBlock)) |
#define | Generation_CHUNKHDRSZ sizeof(GenerationChunk) |
#define | Generation_CHUNK_FRACTION 8 |
#define | GENERATIONCHUNK_RAWSIZE (SIZEOF_SIZE_T + SIZEOF_VOID_P * 2) |
#define | GENERATIONCHUNK_PRIVATE_LEN offsetof(GenerationChunk, context) |
#define | GenerationIsValid(set) PointerIsValid(set) |
#define | GenerationPointerGetChunk(ptr) ((GenerationChunk *)(((char *)(ptr)) - Generation_CHUNKHDRSZ)) |
#define | GenerationChunkGetPointer(chk) ((GenerationPointer *)(((char *)(chk)) + Generation_CHUNKHDRSZ)) |
Typedefs | |
typedef struct GenerationBlock | GenerationBlock |
typedef struct GenerationChunk | GenerationChunk |
typedef void * | GenerationPointer |
typedef struct GenerationContext | GenerationContext |
Variables | |
static const MemoryContextMethods | GenerationMethods |
#define Generation_BLOCKHDRSZ MAXALIGN(sizeof(GenerationBlock)) |
Definition at line 44 of file generation.c.
#define Generation_CHUNK_FRACTION 8 |
Definition at line 47 of file generation.c.
#define Generation_CHUNKHDRSZ sizeof(GenerationChunk) |
Definition at line 45 of file generation.c.
#define GENERATIONCHUNK_PRIVATE_LEN offsetof(GenerationChunk, context) |
Definition at line 141 of file generation.c.
#define GENERATIONCHUNK_RAWSIZE (SIZEOF_SIZE_T + SIZEOF_VOID_P * 2) |
Definition at line 122 of file generation.c.
#define GenerationChunkGetPointer | ( | chk | ) | ((GenerationPointer *)(((char *)(chk)) + Generation_CHUNKHDRSZ)) |
Definition at line 151 of file generation.c.
#define GenerationIsValid | ( | set | ) | PointerIsValid(set) |
Definition at line 147 of file generation.c.
#define GenerationPointerGetChunk | ( | ptr | ) | ((GenerationChunk *)(((char *)(ptr)) - Generation_CHUNKHDRSZ)) |
Definition at line 149 of file generation.c.
typedef struct GenerationBlock GenerationBlock |
Definition at line 1 of file generation.c.
typedef struct GenerationChunk GenerationChunk |
Definition at line 1 of file generation.c.
typedef struct GenerationContext GenerationContext |
typedef void* GenerationPointer |
Definition at line 52 of file generation.c.
|
static |
Definition at line 397 of file generation.c.
References GenerationContext::allocChunkLimit, Assert(), GenerationBlock::blksize, GenerationContext::block, GenerationChunk::block, GenerationContext::blocks, GenerationChunk::context, dlist_push_head(), GenerationBlock::endptr, GenerationContext::freeblock, GenerationBlock::freeptr, Generation_BLOCKHDRSZ, Generation_CHUNKHDRSZ, GenerationBlockFreeBytes(), GenerationBlockInit(), GenerationBlockIsEmpty(), GENERATIONCHUNK_PRIVATE_LEN, GenerationChunkGetPointer, GenerationContext::keeper, malloc, MAXALIGN, GenerationContext::maxBlockSize, MemoryContextData::mem_allocated, GenerationBlock::nchunks, GenerationContext::nextBlockSize, GenerationBlock::nfree, GenerationBlock::node, pg_nextpower2_size_t, GenerationChunk::size, VALGRIND_MAKE_MEM_NOACCESS, and VALGRIND_MAKE_MEM_UNDEFINED.
Referenced by GenerationRealloc().
|
inlinestatic |
Definition at line 640 of file generation.c.
References Assert(), GenerationBlock::blksize, dlist_delete(), free, GenerationContext::freeblock, GenerationContext::keeper, and GenerationBlock::node.
Referenced by GenerationReset().
|
inlinestatic |
Definition at line 630 of file generation.c.
References GenerationBlock::endptr, and GenerationBlock::freeptr.
Referenced by GenerationAlloc().
|
inlinestatic |
Definition at line 577 of file generation.c.
References GenerationBlock::blksize, GenerationBlock::endptr, GenerationBlock::freeptr, Generation_BLOCKHDRSZ, GenerationBlock::nchunks, GenerationBlock::nfree, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by GenerationAlloc(), and GenerationContextCreate().
|
inlinestatic |
Definition at line 596 of file generation.c.
References GenerationBlock::nchunks.
Referenced by GenerationAlloc().
|
inlinestatic |
Definition at line 606 of file generation.c.
References GenerationBlock::freeptr, Generation_BLOCKHDRSZ, GenerationBlock::nchunks, GenerationBlock::nfree, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by GenerationFree(), and GenerationReset().
MemoryContext GenerationContextCreate | ( | MemoryContext | parent, |
const char * | name, | ||
Size | minContextSize, | ||
Size | initBlockSize, | ||
Size | maxBlockSize | ||
) |
Definition at line 215 of file generation.c.
References GenerationContext::allocChunkLimit, AllocHugeSizeIsValid, Assert(), GenerationContext::block, GenerationContext::blocks, dlist_init(), dlist_push_head(), ereport, errcode(), errdetail(), errmsg(), ERROR, GenerationContext::freeblock, Generation_BLOCKHDRSZ, Generation_CHUNK_FRACTION, Generation_CHUNKHDRSZ, GenerationBlockInit(), GenerationMethods, GenerationContext::initBlockSize, GenerationContext::keeper, malloc, Max, MAXALIGN, GenerationContext::maxBlockSize, MemoryContextCreate(), MemoryContextStats(), name, GenerationContext::nextBlockSize, GenerationBlock::node, offsetof, StaticAssertStmt, T_GenerationContext, and TopMemoryContext.
Referenced by gistvacuumscan(), ReorderBufferAllocate(), and tuplesort_begin_batch().
|
static |
|
static |
Definition at line 665 of file generation.c.
References Assert(), GenerationBlock::blksize, GenerationContext::block, GenerationChunk::block, GenerationChunk::context, dlist_delete(), elog, free, GenerationContext::freeblock, GenerationBlockMarkEmpty(), GENERATIONCHUNK_PRIVATE_LEN, GenerationPointerGetChunk, GenerationContext::keeper, MemoryContextData::mem_allocated, name, GenerationBlock::nchunks, GenerationBlock::nfree, GenerationBlock::node, GenerationChunk::size, VALGRIND_MAKE_MEM_DEFINED, and WARNING.
Referenced by GenerationRealloc().
|
static |
Definition at line 862 of file generation.c.
References Generation_CHUNKHDRSZ, GENERATIONCHUNK_PRIVATE_LEN, GenerationPointerGetChunk, GenerationChunk::size, VALGRIND_MAKE_MEM_DEFINED, and VALGRIND_MAKE_MEM_NOACCESS.
|
static |
Definition at line 878 of file generation.c.
References GenerationContext::blocks, dlist_iter::cur, dlist_container, dlist_foreach, and GenerationBlock::nchunks.
|
static |
Definition at line 746 of file generation.c.
References elog, GenerationAlloc(), GENERATIONCHUNK_PRIVATE_LEN, GenerationFree(), GenerationPointerGetChunk, name, GenerationChunk::size, VALGRIND_MAKE_MEM_DEFINED, VALGRIND_MAKE_MEM_NOACCESS, VALGRIND_MAKE_MEM_UNDEFINED, and WARNING.
|
static |
Definition at line 330 of file generation.c.
References Assert(), AssertArg, GenerationContext::block, GenerationContext::blocks, dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, dlist_has_next(), dlist_head_node(), dlist_is_empty(), GenerationContext::freeblock, GenerationBlockFree(), GenerationBlockMarkEmpty(), GenerationIsValid, GenerationContext::initBlockSize, GenerationContext::keeper, and GenerationContext::nextBlockSize.
Referenced by GenerationDelete().
|
static |
Definition at line 907 of file generation.c.
References GenerationBlock::blksize, GenerationContext::blocks, dlist_iter::cur, dlist_container, dlist_foreach, GenerationBlock::endptr, MemoryContextCounters::freechunks, GenerationBlock::freeptr, MemoryContextCounters::freespace, MAXALIGN, MemoryContextCounters::nblocks, GenerationBlock::nchunks, GenerationBlock::nfree, snprintf, and MemoryContextCounters::totalspace.
|
static |
Definition at line 184 of file generation.c.
Referenced by GenerationContextCreate().