mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-27 04:37:19 +02:00
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
This commit is contained in:
parent
fcd93e4af9
commit
bea38f34a4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user