Skip to content
Snippets Groups Projects
Commit 60b6d99d authored by Robert Haas's avatar Robert Haas
Browse files

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
parent e2838c58
No related branches found
No related tags found
No related merge requests found
...@@ -124,7 +124,9 @@ pg_buffercache_pages(PG_FUNCTION_ARGS) ...@@ -124,7 +124,9 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
fctx->tupdesc = BlessTupleDesc(tupledesc); fctx->tupdesc = BlessTupleDesc(tupledesc);
/* Allocate NBuffers worth of BufferCachePagesRec records. */ /* 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. */ /* Set max calls and remember the user function context. */
funcctx->max_calls = NBuffers; funcctx->max_calls = NBuffers;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment