PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "lib/ilist.h"
#include "utils/memdebug.h"
#include "utils/memutils.h"
Go to the source code of this file.
Data Structures | |
struct | SlabContext |
struct | SlabBlock |
struct | SlabChunk |
Macros | |
#define | SlabPointerGetChunk(ptr) ((SlabChunk *)(((char *)(ptr)) - sizeof(SlabChunk))) |
#define | SlabChunkGetPointer(chk) ((void *)(((char *)(chk)) + sizeof(SlabChunk))) |
#define | SlabBlockGetChunk(slab, block, idx) |
#define | SlabBlockStart(block) ((char *) block + sizeof(SlabBlock)) |
#define | SlabChunkIndex(slab, block, chunk) (((char *) chunk - SlabBlockStart(block)) / slab->fullChunkSize) |
Typedefs | |
typedef struct SlabContext | SlabContext |
typedef struct SlabBlock | SlabBlock |
typedef struct SlabChunk | SlabChunk |
Functions | |
static void * | SlabAlloc (MemoryContext context, Size size) |
static void | SlabFree (MemoryContext context, void *pointer) |
static void * | SlabRealloc (MemoryContext context, void *pointer, Size size) |
static void | SlabReset (MemoryContext context) |
static void | SlabDelete (MemoryContext context) |
static Size | SlabGetChunkSpace (MemoryContext context, void *pointer) |
static bool | SlabIsEmpty (MemoryContext context) |
static void | SlabStats (MemoryContext context, MemoryStatsPrintFunc printfunc, void *passthru, MemoryContextCounters *totals, bool print_to_stderr) |
MemoryContext | SlabContextCreate (MemoryContext parent, const char *name, Size blockSize, Size chunkSize) |
Variables | |
static const MemoryContextMethods | SlabMethods |
#define SlabBlockGetChunk | ( | slab, | |
block, | |||
idx | |||
) |
#define SlabBlockStart | ( | block | ) | ((char *) block + sizeof(SlabBlock)) |
#define SlabChunkGetPointer | ( | chk | ) | ((void *)(((char *)(chk)) + sizeof(SlabChunk))) |
#define SlabChunkIndex | ( | slab, | |
block, | |||
chunk | |||
) | (((char *) chunk - SlabBlockStart(block)) / slab->fullChunkSize) |
typedef struct SlabContext SlabContext |
|
static |
Definition at line 340 of file slab.c.
References Assert(), SlabChunk::block, SlabContext::blockSize, castNode, SlabContext::chunkSize, SlabContext::chunksPerBlock, dlist_delete(), dlist_head_element, dlist_is_empty(), dlist_push_head(), elog, ERROR, SlabBlock::firstFreeChunk, SlabContext::freelist, SlabContext::fullChunkSize, idx(), malloc, MemoryContextData::mem_allocated, SlabContext::minFreeChunks, SlabContext::nblocks, SlabBlock::nfree, SlabBlock::node, SlabChunk::slab, SlabBlockGetChunk, SlabChunkGetPointer, VALGRIND_MAKE_MEM_DEFINED, VALGRIND_MAKE_MEM_NOACCESS, and VALGRIND_MAKE_MEM_UNDEFINED.
MemoryContext SlabContextCreate | ( | MemoryContext | parent, |
const char * | name, | ||
Size | blockSize, | ||
Size | chunkSize | ||
) |
Definition at line 175 of file slab.c.
References SlabContext::blockSize, SlabContext::chunkSize, SlabContext::chunksPerBlock, dlist_init(), elog, ereport, errcode(), errdetail(), errmsg(), ERROR, SlabContext::freelist, SlabContext::fullChunkSize, SlabContext::headerSize, i, malloc, MAXALIGN, MemoryContextCreate(), MemoryContextStats(), SlabContext::minFreeChunks, name, SlabContext::nblocks, offsetof, SlabMethods, StaticAssertStmt, T_SlabContext, and TopMemoryContext.
Referenced by ReorderBufferAllocate().
|
static |
|
static |
Definition at line 498 of file slab.c.
References Assert(), SlabChunk::block, SlabContext::blockSize, castNode, SlabContext::chunkSize, SlabContext::chunksPerBlock, dlist_delete(), dlist_is_empty(), dlist_push_head(), elog, SlabBlock::firstFreeChunk, free, SlabContext::freelist, SlabContext::fullChunkSize, SlabContext::header, idx(), MemoryContextData::mem_allocated, SlabContext::minFreeChunks, MemoryContextData::name, SlabContext::nblocks, SlabBlock::nfree, SlabBlock::node, SlabChunkIndex, SlabPointerGetChunk, and WARNING.
|
static |
Definition at line 606 of file slab.c.
References Assert(), castNode, and SlabContext::fullChunkSize.
|
static |
|
static |
|
static |
Definition at line 283 of file slab.c.
References Assert(), SlabContext::blockSize, castNode, SlabContext::chunksPerBlock, dlist_mutable_iter::cur, dlist_container, dlist_delete(), dlist_foreach_modify, free, SlabContext::freelist, i, MemoryContextData::mem_allocated, SlabContext::minFreeChunks, and SlabContext::nblocks.
Referenced by SlabDelete().
|
static |
Definition at line 639 of file slab.c.
References SlabContext::blockSize, castNode, SlabContext::chunksPerBlock, dlist_iter::cur, dlist_container, dlist_foreach, MemoryContextCounters::freechunks, SlabContext::freelist, MemoryContextCounters::freespace, SlabContext::fullChunkSize, SlabContext::headerSize, i, MemoryContextCounters::nblocks, SlabBlock::nfree, snprintf, and MemoryContextCounters::totalspace.
|
static |
Definition at line 147 of file slab.c.
Referenced by SlabContextCreate().