40 #define MaxAllocSize ((Size) 0x3fffffff) 42 #define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize) 44 #define MaxAllocHugeSize (SIZE_MAX / 2) 46 #define AllocHugeSizeIsValid(size) ((Size) (size) <= MaxAllocHugeSize) 67 #define MemoryContextResetAndDeleteChildren(ctx) MemoryContextReset(ctx) 91 #ifdef MEMORY_CONTEXT_CHECKING 97 #define MemoryContextCopyAndSetIdentifier(cxt, id) \ 98 MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id)) 128 context = *(
MemoryContext *) (((
char *) pointer) -
sizeof(
void *));
164 #ifdef HAVE__BUILTIN_CONSTANT_P 165 #define AllocSetContextCreate(parent, name, ...) \ 166 (StaticAssertExpr(__builtin_constant_p(name), \ 167 "memory context names must be constant strings"), \ 168 AllocSetContextCreateInternal(parent, name, __VA_ARGS__)) 170 #define AllocSetContextCreate \ 171 AllocSetContextCreateInternal 189 #define ALLOCSET_DEFAULT_MINSIZE 0 190 #define ALLOCSET_DEFAULT_INITSIZE (8 * 1024) 191 #define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024) 192 #define ALLOCSET_DEFAULT_SIZES \ 193 ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE 199 #define ALLOCSET_SMALL_MINSIZE 0 200 #define ALLOCSET_SMALL_INITSIZE (1 * 1024) 201 #define ALLOCSET_SMALL_MAXSIZE (8 * 1024) 202 #define ALLOCSET_SMALL_SIZES \ 203 ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE 209 #define ALLOCSET_START_SMALL_SIZES \ 210 ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE 219 #define ALLOCSET_SEPARATE_THRESHOLD 8192 221 #define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024) 222 #define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024) void MemoryContextDelete(MemoryContext context)
PGDLLIMPORT MemoryContext CacheMemoryContext
bool MemoryContextIsEmpty(MemoryContext context)
void MemoryContextAllowInCriticalSection(MemoryContext context, bool allow)
MemoryContext SlabContextCreate(MemoryContext parent, const char *name, Size blockSize, Size chunkSize)
void MemoryContextDeleteChildren(MemoryContext context)
void MemoryContextResetOnly(MemoryContext context)
void MemoryContextReset(MemoryContext context)
PGDLLIMPORT MemoryContext PortalContext
Size MemoryContextMemAllocated(MemoryContext context, bool recurse)
void MemoryContextSetIdentifier(MemoryContext context, const char *id)
PGDLLIMPORT MemoryContext PostmasterContext
MemoryContext AllocSetContextCreateInternal(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)
bool MemoryContextContains(MemoryContext context, void *pointer)
void MemoryContextStats(MemoryContext context)
PGDLLIMPORT MemoryContext TopTransactionContext
PGDLLIMPORT MemoryContext MessageContext
MemoryContext MemoryContextGetParent(MemoryContext context)
Size GetMemoryChunkSpace(void *pointer)
void MemoryContextResetChildren(MemoryContext context)
void MemoryContextCreate(MemoryContext node, NodeTag tag, const MemoryContextMethods *methods, MemoryContext parent, const char *name)
#define AssertArg(condition)
MemoryContext GenerationContextCreate(MemoryContext parent, const char *name, Size blockSize)
PGDLLIMPORT MemoryContext CurTransactionContext
void MemoryContextStatsDetail(MemoryContext context, int max_children)
#define MemoryContextIsValid(context)
#define Assert(condition)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
PGDLLIMPORT MemoryContext TopMemoryContext
PGDLLIMPORT MemoryContext ErrorContext
void MemoryContextInit(void)
static MemoryContext GetMemoryChunkContext(void *pointer)