summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorRobert Haas2016-09-15 13:22:52 +0000
committerRobert Haas2016-09-15 13:30:38 +0000
commit8a503526e455b981718c2d24bd1630fd5b4cf7ac (patch)
tree7c4329b396775483a33f92d4133f53efcf16dcef /contrib
parent593d4e47db7af1a3a5dd6b6b1971f181b5566dbd (diff)
pg_buffercache: Allow huge allocations.
Otherwise, users who have configured shared_buffers >= 256GB won't be able to use this module. There probably aren't many of those, but it doesn't hurt anything to fix it so that it works. Backpatch to 9.4, where MemoryContextAllocHuge was introduced. The same problem exists in older branches, but there's no easy way to fix it there. KaiGai Kohei
Diffstat (limited to 'contrib')
-rw-r--r--contrib/pg_buffercache/pg_buffercache_pages.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index 17b4b6fa6f..da13bde359 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -124,7 +124,9 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
fctx->tupdesc = BlessTupleDesc(tupledesc);
/* Allocate NBuffers worth of BufferCachePagesRec records. */
- fctx->record = (BufferCachePagesRec *) palloc(sizeof(BufferCachePagesRec) * NBuffers);
+ fctx->record = (BufferCachePagesRec *)
+ MemoryContextAllocHuge(CurrentMemoryContext,
+ sizeof(BufferCachePagesRec) * NBuffers);
/* Set max calls and remember the user function context. */
funcctx->max_calls = NBuffers;