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)
91 int max_level,
int max_children,
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
157 #define ALLOCSET_DEFAULT_MINSIZE 0
158 #define ALLOCSET_DEFAULT_INITSIZE (8 * 1024)
159 #define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024)
160 #define ALLOCSET_DEFAULT_SIZES \
161 ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE
167 #define ALLOCSET_SMALL_MINSIZE 0
168 #define ALLOCSET_SMALL_INITSIZE (1 * 1024)
169 #define ALLOCSET_SMALL_MAXSIZE (8 * 1024)
170 #define ALLOCSET_SMALL_SIZES \
171 ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE
177 #define ALLOCSET_START_SMALL_SIZES \
178 ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE
187 #define ALLOCSET_SEPARATE_THRESHOLD 8192
189 #define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024)
190 #define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024)
PGDLLIMPORT MemoryContext CurTransactionContext
bool MemoryContextIsEmpty(MemoryContext context)
void MemoryContextMemConsumed(MemoryContext context, MemoryContextCounters *consumed)
void MemoryContextReset(MemoryContext context)
PGDLLIMPORT MemoryContext MessageContext
PGDLLIMPORT MemoryContext TopMemoryContext
PGDLLIMPORT MemoryContext TopTransactionContext
void HandleLogMemoryContextInterrupt(void)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
Size GetMemoryChunkSpace(void *pointer)
void MemoryContextDeleteChildren(MemoryContext context)
MemoryContext GetMemoryChunkContext(void *pointer)
PGDLLIMPORT MemoryContext PostmasterContext
void MemoryContextStatsDetail(MemoryContext context, int max_level, int max_children, bool print_to_stderr)
Size MemoryContextMemAllocated(MemoryContext context, bool recurse)
void MemoryContextStats(MemoryContext context)
MemoryContext SlabContextCreate(MemoryContext parent, const char *name, Size blockSize, Size chunkSize)
void MemoryContextInit(void)
MemoryContext BumpContextCreate(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)
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)