summaryrefslogtreecommitdiff
path: root/src/include/utils/palloc.h
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2013-06-27 14:53:57 -0400
committerNoah Misch <noah@leadboat.com>2013-06-27 14:53:57 -0400
commit263865a48973767ce8ed7b7788059a38a24a9f37 (patch)
tree282d6522ada24adc923ea869c01b9d94f02685db /src/include/utils/palloc.h
parent9ef86cd994e9f2a684996df994d4657e84a6c0bb (diff)
Permit super-MaxAllocSize allocations with MemoryContextAllocHuge().
The MaxAllocSize guard is convenient for most callers, because it reduces the need for careful attention to overflow, data type selection, and the SET_VARSIZE() limit. A handful of callers are happy to navigate those hazards in exchange for the ability to allocate a larger chunk. Introduce MemoryContextAllocHuge() and repalloc_huge(). Use this in tuplesort.c and tuplestore.c, enabling internal sorts of up to INT_MAX tuples, a factor-of-48 increase. In particular, B-tree index builds can now benefit from much-larger maintenance_work_mem settings. Reviewed by Stephen Frost, Simon Riggs and Jeff Janes.
Diffstat (limited to 'src/include/utils/palloc.h')
-rw-r--r--src/include/utils/palloc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h
index 420bde7ee4a..01e7db5d4f9 100644
--- a/src/include/utils/palloc.h
+++ b/src/include/utils/palloc.h
@@ -51,6 +51,10 @@ extern void *MemoryContextAlloc(MemoryContext context, Size size);
extern void *MemoryContextAllocZero(MemoryContext context, Size size);
extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size);
+/* Higher-limit allocators. */
+extern void *MemoryContextAllocHuge(MemoryContext context, Size size);
+extern void *repalloc_huge(void *pointer, Size size);
+
/*
* The result of palloc() is always word-aligned, so we can skip testing
* alignment of the pointer when deciding which MemSet variant to use.