40 #define MaxAllocSize ((Size) 0x3fffffff)
42 #define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize)
45 #define MaxAllocHugeSize (SIZE_MAX / 2)
47 #define InvalidAllocSize SIZE_MAX
49 #define AllocHugeSizeIsValid(size) ((Size) (size) <= MaxAllocHugeSize)
70 #define MemoryContextResetAndDeleteChildren(ctx) MemoryContextReset(ctx)
92 bool print_to_stderr);
96 #ifdef MEMORY_CONTEXT_CHECKING
101 #define MemoryContextCopyAndSetIdentifier(cxt, id) \
102 MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id))
123 #ifdef HAVE__BUILTIN_CONSTANT_P
124 #define AllocSetContextCreate(parent, name, ...) \
125 (StaticAssertExpr(__builtin_constant_p(name), \
126 "memory context names must be constant strings"), \
127 AllocSetContextCreateInternal(parent, name, __VA_ARGS__))
129 #define AllocSetContextCreate \
130 AllocSetContextCreateInternal
150 #define ALLOCSET_DEFAULT_MINSIZE 0
151 #define ALLOCSET_DEFAULT_INITSIZE (8 * 1024)
152 #define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024)
153 #define ALLOCSET_DEFAULT_SIZES \
154 ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE
160 #define ALLOCSET_SMALL_MINSIZE 0
161 #define ALLOCSET_SMALL_INITSIZE (1 * 1024)
162 #define ALLOCSET_SMALL_MAXSIZE (8 * 1024)
163 #define ALLOCSET_SMALL_SIZES \
164 ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE
170 #define ALLOCSET_START_SMALL_SIZES \
171 ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE
180 #define ALLOCSET_SEPARATE_THRESHOLD 8192
182 #define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024)
183 #define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024)
PGDLLIMPORT MemoryContext CurTransactionContext
bool MemoryContextIsEmpty(MemoryContext context)
void MemoryContextReset(MemoryContext context)
PGDLLIMPORT MemoryContext MessageContext
PGDLLIMPORT MemoryContext TopMemoryContext
PGDLLIMPORT MemoryContext TopTransactionContext
void HandleLogMemoryContextInterrupt(void)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
void MemoryContextStatsDetail(MemoryContext context, int max_children, bool print_to_stderr)
Size GetMemoryChunkSpace(void *pointer)
void MemoryContextDeleteChildren(MemoryContext context)
MemoryContext GetMemoryChunkContext(void *pointer)
PGDLLIMPORT MemoryContext PostmasterContext
Size MemoryContextMemAllocated(MemoryContext context, bool recurse)
void MemoryContextStats(MemoryContext context)
MemoryContext SlabContextCreate(MemoryContext parent, const char *name, Size blockSize, Size chunkSize)
void MemoryContextInit(void)
PGDLLIMPORT MemoryContext CacheMemoryContext
MemoryContext MemoryContextGetParent(MemoryContext context)
void ProcessLogMemoryContextInterrupt(void)
PGDLLIMPORT MemoryContext PortalContext
MemoryContext GenerationContextCreate(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)
void MemoryContextDelete(MemoryContext context)
void MemoryContextAllowInCriticalSection(MemoryContext context, bool allow)
void MemoryContextResetChildren(MemoryContext context)
void MemoryContextSetIdentifier(MemoryContext context, const char *id)
void MemoryContextResetOnly(MemoryContext context)
PGDLLIMPORT MemoryContext ErrorContext
MemoryContext AllocSetContextCreateInternal(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)