| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #ifndef MEMUTILS_H |
| | #define MEMUTILS_H |
| |
|
| | #include "nodes/memnodes.h" |
| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #define MaxAllocSize ((Size) 0x3fffffff) |
| |
|
| | #define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize) |
| |
|
| | |
| | #define MaxAllocHugeSize (SIZE_MAX / 2) |
| |
|
| | #define InvalidAllocSize SIZE_MAX |
| |
|
| | #define AllocHugeSizeIsValid(size) ((Size) (size) <= MaxAllocHugeSize) |
| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | extern PGDLLIMPORT MemoryContext TopMemoryContext; |
| | extern PGDLLIMPORT MemoryContext ErrorContext; |
| | extern PGDLLIMPORT MemoryContext PostmasterContext; |
| | extern PGDLLIMPORT MemoryContext CacheMemoryContext; |
| | extern PGDLLIMPORT MemoryContext MessageContext; |
| | extern PGDLLIMPORT MemoryContext TopTransactionContext; |
| | extern PGDLLIMPORT MemoryContext CurTransactionContext; |
| |
|
| | |
| | extern PGDLLIMPORT MemoryContext PortalContext; |
| |
|
| |
|
| | |
| | |
| | |
| | extern void MemoryContextInit(void); |
| | extern void MemoryContextReset(MemoryContext context); |
| | extern void MemoryContextDelete(MemoryContext context); |
| | extern void MemoryContextResetOnly(MemoryContext context); |
| | extern void MemoryContextResetChildren(MemoryContext context); |
| | extern void MemoryContextDeleteChildren(MemoryContext context); |
| | extern void MemoryContextSetIdentifier(MemoryContext context, const char *id); |
| | extern void MemoryContextSetParent(MemoryContext context, |
| | MemoryContext new_parent); |
| | extern MemoryContext GetMemoryChunkContext(void *pointer); |
| | extern Size GetMemoryChunkSpace(void *pointer); |
| | extern MemoryContext MemoryContextGetParent(MemoryContext context); |
| | extern bool MemoryContextIsEmpty(MemoryContext context); |
| | extern Size MemoryContextMemAllocated(MemoryContext context, bool recurse); |
| | extern void MemoryContextMemConsumed(MemoryContext context, |
| | MemoryContextCounters *consumed); |
| | extern void MemoryContextStats(MemoryContext context); |
| | extern void MemoryContextStatsDetail(MemoryContext context, |
| | int max_level, int max_children, |
| | bool print_to_stderr); |
| | extern void MemoryContextAllowInCriticalSection(MemoryContext context, |
| | bool allow); |
| |
|
| | #ifdef MEMORY_CONTEXT_CHECKING |
| | extern void MemoryContextCheck(MemoryContext context); |
| | #endif |
| |
|
| | |
| | #define MemoryContextCopyAndSetIdentifier(cxt, id) \ |
| | MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id)) |
| |
|
| | extern void HandleLogMemoryContextInterrupt(void); |
| | extern void ProcessLogMemoryContextInterrupt(void); |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | extern MemoryContext AllocSetContextCreateInternal(MemoryContext parent, |
| | const char *name, |
| | Size minContextSize, |
| | Size initBlockSize, |
| | Size maxBlockSize); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | #ifdef HAVE__BUILTIN_CONSTANT_P |
| | #define AllocSetContextCreate(parent, name, ...) \ |
| | (StaticAssertExpr(__builtin_constant_p(name), \ |
| | "memory context names must be constant strings"), \ |
| | AllocSetContextCreateInternal(parent, name, __VA_ARGS__)) |
| | #else |
| | #define AllocSetContextCreate \ |
| | AllocSetContextCreateInternal |
| | #endif |
| |
|
| | |
| | extern MemoryContext SlabContextCreate(MemoryContext parent, |
| | const char *name, |
| | Size blockSize, |
| | Size chunkSize); |
| |
|
| | |
| | extern MemoryContext GenerationContextCreate(MemoryContext parent, |
| | const char *name, |
| | Size minContextSize, |
| | Size initBlockSize, |
| | Size maxBlockSize); |
| |
|
| | |
| | extern MemoryContext BumpContextCreate(MemoryContext parent, |
| | const char *name, |
| | Size minContextSize, |
| | Size initBlockSize, |
| | Size maxBlockSize); |
| |
|
| | |
| | |
| | |
| | |
| | #define ALLOCSET_DEFAULT_MINSIZE 0 |
| | #define ALLOCSET_DEFAULT_INITSIZE (8 * 1024) |
| | #define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024) |
| | #define ALLOCSET_DEFAULT_SIZES \ |
| | ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE |
| |
|
| | |
| | |
| | |
| | |
| | #define ALLOCSET_SMALL_MINSIZE 0 |
| | #define ALLOCSET_SMALL_INITSIZE (1 * 1024) |
| | #define ALLOCSET_SMALL_MAXSIZE (8 * 1024) |
| | #define ALLOCSET_SMALL_SIZES \ |
| | ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE |
| |
|
| | |
| | |
| | |
| | |
| | #define ALLOCSET_START_SMALL_SIZES \ |
| | ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE |
| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | #define ALLOCSET_SEPARATE_THRESHOLD 8192 |
| |
|
| | #define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024) |
| | #define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024) |
| |
|
| | #endif |
| |
|