diff options
Diffstat (limited to 'src/include/utils')
-rw-r--r-- | src/include/utils/memutils.h | 7 | ||||
-rw-r--r-- | src/include/utils/memutils_internal.h | 18 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h index 6e5fa72b0e1..cd9596ff219 100644 --- a/src/include/utils/memutils.h +++ b/src/include/utils/memutils.h @@ -143,6 +143,13 @@ extern MemoryContext GenerationContextCreate(MemoryContext parent, Size initBlockSize, Size maxBlockSize); +/* bump.c */ +extern MemoryContext BumpContextCreate(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + /* * Recommended default alloc parameters, suitable for "ordinary" contexts * that might hold quite a lot of data. diff --git a/src/include/utils/memutils_internal.h b/src/include/utils/memutils_internal.h index 2d032611556..5ce2d9b5877 100644 --- a/src/include/utils/memutils_internal.h +++ b/src/include/utils/memutils_internal.h @@ -79,6 +79,22 @@ extern void *AlignedAllocRealloc(void *pointer, Size size, int flags); extern MemoryContext AlignedAllocGetChunkContext(void *pointer); extern Size AlignedAllocGetChunkSpace(void *pointer); + /* These functions implement the MemoryContext API for the Bump context. */ +extern void *BumpAlloc(MemoryContext context, Size size, int flags); +extern void BumpFree(void *pointer); +extern void *BumpRealloc(void *pointer, Size size, int flags); +extern void BumpReset(MemoryContext context); +extern void BumpDelete(MemoryContext context); +extern MemoryContext BumpGetChunkContext(void *pointer); +extern Size BumpGetChunkSpace(void *pointer); +extern bool BumpIsEmpty(MemoryContext context); +extern void BumpStats(MemoryContext context, MemoryStatsPrintFunc printfunc, + void *passthru, MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void BumpCheck(MemoryContext context); +#endif + /* * How many extra bytes do we need to request in order to ensure that we can * align a pointer to 'alignto'. Since palloc'd pointers are already aligned @@ -111,7 +127,7 @@ typedef enum MemoryContextMethodID MCTX_GENERATION_ID, MCTX_SLAB_ID, MCTX_ALIGNED_REDIRECT_ID, - MCTX_7_UNUSED_ID, + MCTX_BUMP_ID, MCTX_8_UNUSED_ID, MCTX_9_UNUSED_ID, MCTX_10_UNUSED_ID, |