diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-08-27 17:50:38 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-08-27 17:50:38 -0400 |
| commit | ea268cdc9a2631da4a5748b00059a9fd43470d0e (patch) | |
| tree | 0df73b871a0990feae7fb5689fc69acdcad1a3d6 /src/backend/utils | |
| parent | 26fa446da64716f12ab3a623434c644fcb344b2e (diff) | |
| download | postgresql-ea268cdc9a2631da4a5748b00059a9fd43470d0e.tar.gz | |
Add macros to make AllocSetContextCreate() calls simpler and safer.
I found that half a dozen (nearly 5%) of our AllocSetContextCreate calls
had typos in the context-sizing parameters. While none of these led to
especially significant problems, they did create minor inefficiencies,
and it's now clear that expecting people to copy-and-paste those calls
accurately is not a great idea. Let's reduce the risk of future errors
by introducing single macros that encapsulate the common use-cases.
Three such macros are enough to cover all but two special-purpose contexts;
those two calls can be left as-is, I think.
While this patch doesn't in itself improve matters for third-party
extensions, it doesn't break anything for them either, and they can
gradually adopt the simplified notation over time.
In passing, change TopMemoryContext to use the default allocation
parameters. Formerly it could only be extended 8K at a time. That was
probably reasonable when this code was written; but nowadays we create
many more contexts than we did then, so that it's not unusual to have a
couple hundred K in TopMemoryContext, even without considering various
dubious code that sticks other things there. There seems no good reason
not to let it use growing blocks like most other contexts.
Back-patch to 9.6, mostly because that's still close enough to HEAD that
it's easy to do so, and keeping the branches in sync can be expected to
avoid some future back-patching pain. The bugs fixed by these changes
don't seem to be significant enough to justify fixing them further back.
Discussion: <21072.1472321324@sss.pgh.pa.us>
Diffstat (limited to 'src/backend/utils')
| -rw-r--r-- | src/backend/utils/adt/array_expanded.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/adt/arrayfuncs.c | 8 | ||||
| -rw-r--r-- | src/backend/utils/adt/jsonfuncs.c | 16 | ||||
| -rw-r--r-- | src/backend/utils/adt/xml.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/cache/catcache.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/cache/evtcache.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/cache/plancache.c | 35 | ||||
| -rw-r--r-- | src/backend/utils/cache/relcache.c | 18 | ||||
| -rw-r--r-- | src/backend/utils/cache/ts_cache.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/cache/typcache.c | 8 | ||||
| -rw-r--r-- | src/backend/utils/fmgr/funcapi.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/hash/dynahash.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/init/postinit.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/misc/guc-file.l | 4 | ||||
| -rw-r--r-- | src/backend/utils/misc/tzparser.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/mmgr/aset.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/mmgr/mcxt.c | 11 | ||||
| -rw-r--r-- | src/backend/utils/mmgr/portalmem.c | 12 | ||||
| -rw-r--r-- | src/backend/utils/sort/tuplesort.c | 8 |
19 files changed, 48 insertions, 116 deletions
diff --git a/src/backend/utils/adt/array_expanded.c b/src/backend/utils/adt/array_expanded.c index 7dd7e3fbcb..94eb19d45d 100644 --- a/src/backend/utils/adt/array_expanded.c +++ b/src/backend/utils/adt/array_expanded.c @@ -63,9 +63,7 @@ expand_array(Datum arraydatum, MemoryContext parentcontext, */ objcxt = AllocSetContextCreate(parentcontext, "expanded array", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); /* Set up expanded array header */ eah = (ExpandedArrayHeader *) diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 8fbd850146..1db7bf0a35 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -4957,9 +4957,7 @@ initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext) if (subcontext) arr_context = AllocSetContextCreate(rcontext, "accumArrayResult", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); astate = (ArrayBuildState *) MemoryContextAlloc(arr_context, sizeof(ArrayBuildState)); @@ -5161,9 +5159,7 @@ initArrayResultArr(Oid array_type, Oid element_type, MemoryContext rcontext, if (subcontext) arr_context = AllocSetContextCreate(rcontext, "accumArrayResultArr", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); /* Note we initialize all fields to zero */ astate = (ArrayBuildStateArr *) diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index a80a20ecee..996007d483 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -1503,9 +1503,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text) tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, "jsonb_each temporary cxt", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); it = JsonbIteratorInit(&jb->root); @@ -1641,9 +1639,7 @@ each_worker(FunctionCallInfo fcinfo, bool as_text) state->lex = lex; state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, "json_each temporary cxt", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); pg_parse_json(lex, sem); @@ -1822,9 +1818,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, "jsonb_array_elements temporary cxt", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); it = JsonbIteratorInit(&jb->root); @@ -1962,9 +1956,7 @@ elements_worker(FunctionCallInfo fcinfo, const char *funcname, bool as_text) state->lex = lex; state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, "json_array_elements temporary cxt", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); pg_parse_json(lex, sem); diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 7ed5bcb93d..b144920ec6 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -1455,10 +1455,8 @@ xml_memory_init(void) /* Create memory context if not there already */ if (LibxmlContext == NULL) LibxmlContext = AllocSetContextCreate(TopMemoryContext, - "LibxmlContext", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + "Libxml context", + ALLOCSET_DEFAULT_SIZES); /* Re-establish the callbacks even if already set */ xmlMemSetup(xml_pfree, xml_palloc, xml_repalloc, xml_pstrdup); diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index e929616c97..db7099fc0e 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -536,9 +536,7 @@ CreateCacheMemoryContext(void) if (!CacheMemoryContext) CacheMemoryContext = AllocSetContextCreate(TopMemoryContext, "CacheMemoryContext", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); } diff --git a/src/backend/utils/cache/evtcache.c b/src/backend/utils/cache/evtcache.c index 6fc1df880b..8a620a51c8 100644 --- a/src/backend/utils/cache/evtcache.c +++ b/src/backend/utils/cache/evtcache.c @@ -105,9 +105,7 @@ BuildEventTriggerCache(void) EventTriggerCacheContext = AllocSetContextCreate(CacheMemoryContext, "EventTriggerCache", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); CacheRegisterSyscacheCallback(EVENTTRIGGEROID, InvalidateEventCacheCallback, (Datum) 0); diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c index f42a62d500..c96a86500a 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c @@ -159,15 +159,13 @@ CreateCachedPlan(Node *raw_parse_tree, /* * Make a dedicated memory context for the CachedPlanSource and its * permanent subsidiary data. It's probably not going to be large, but - * just in case, use the default maxsize parameter. Initially it's a - * child of the caller's context (which we assume to be transient), so - * that it will be cleaned up on error. + * just in case, allow it to grow large. Initially it's a child of the + * caller's context (which we assume to be transient), so that it will be + * cleaned up on error. */ source_context = AllocSetContextCreate(CurrentMemoryContext, "CachedPlanSource", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); /* * Create and fill the CachedPlanSource struct within the new context. @@ -359,9 +357,7 @@ CompleteCachedPlan(CachedPlanSource *plansource, /* Again, it's a good bet the querytree_context can be small */ querytree_context = AllocSetContextCreate(source_context, "CachedPlanQuery", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); MemoryContextSwitchTo(querytree_context); querytree_list = (List *) copyObject(querytree_list); } @@ -733,9 +729,7 @@ RevalidateCachedQuery(CachedPlanSource *plansource) */ querytree_context = AllocSetContextCreate(CurrentMemoryContext, "CachedPlanQuery", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); oldcxt = MemoryContextSwitchTo(querytree_context); qlist = (List *) copyObject(tlist); @@ -955,17 +949,14 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist, /* * Normally we make a dedicated memory context for the CachedPlan and its * subsidiary data. (It's probably not going to be large, but just in - * case, use the default maxsize parameter. It's transient for the - * moment.) But for a one-shot plan, we just leave it in the caller's - * memory context. + * case, allow it to grow large. It's transient for the moment.) But for + * a one-shot plan, we just leave it in the caller's memory context. */ if (!plansource->is_oneshot) { plan_context = AllocSetContextCreate(CurrentMemoryContext, "CachedPlan", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); /* * Copy plan into the new context. @@ -1351,9 +1342,7 @@ CopyCachedPlan(CachedPlanSource *plansource) source_context = AllocSetContextCreate(CurrentMemoryContext, "CachedPlanSource", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); oldcxt = MemoryContextSwitchTo(source_context); @@ -1384,9 +1373,7 @@ CopyCachedPlan(CachedPlanSource *plansource) querytree_context = AllocSetContextCreate(source_context, "CachedPlanQuery", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_START_SMALL_SIZES); MemoryContextSwitchTo(querytree_context); newsource->query_list = (List *) copyObject(plansource->query_list); newsource->relationOids = (List *) copyObject(plansource->relationOids); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 8d2ad018bb..79e0b1ff48 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -659,14 +659,11 @@ RelationBuildRuleLock(Relation relation) int maxlocks; /* - * Make the private context. Parameters are set on the assumption that - * it'll probably not contain much data. + * Make the private context. Assume it'll not contain much data. */ rulescxt = AllocSetContextCreate(CacheMemoryContext, RelationGetRelationName(relation), - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); relation->rd_rulescxt = rulescxt; /* @@ -1248,15 +1245,10 @@ RelationInitIndexAccessInfo(Relation relation) * Make the private context to hold index access info. The reason we need * a context, and not just a couple of pallocs, is so that we won't leak * any subsidiary info attached to fmgr lookup records. - * - * Context parameters are set on the assumption that it'll probably not - * contain much data. */ indexcxt = AllocSetContextCreate(CacheMemoryContext, RelationGetRelationName(relation), - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); relation->rd_indexcxt = indexcxt; /* @@ -4948,9 +4940,7 @@ load_relcache_init_file(bool shared) */ indexcxt = AllocSetContextCreate(CacheMemoryContext, RelationGetRelationName(rel), - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); rel->rd_indexcxt = indexcxt; /* diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index 5e4de431dd..50f17438fb 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -295,9 +295,7 @@ lookup_ts_dictionary_cache(Oid dictId) /* Create private memory context the first time through */ saveCtx = AllocSetContextCreate(CacheMemoryContext, NameStr(dict->dictname), - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); } else { diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index ea6f787a52..9150fe832f 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -756,9 +756,7 @@ load_domaintype_info(TypeCacheEntry *typentry) cxt = AllocSetContextCreate(CurrentMemoryContext, "Domain constraints", - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); dcc = (DomainConstraintCache *) MemoryContextAlloc(cxt, sizeof(DomainConstraintCache)); dcc->constraints = NIL; @@ -841,9 +839,7 @@ load_domaintype_info(TypeCacheEntry *typentry) cxt = AllocSetContextCreate(CurrentMemoryContext, "Domain constraints", - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); dcc = (DomainConstraintCache *) MemoryContextAlloc(cxt, sizeof(DomainConstraintCache)); dcc->constraints = NIL; diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index 5d179ae8a8..5d49fe5b50 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -73,9 +73,7 @@ init_MultiFuncCall(PG_FUNCTION_ARGS) */ multi_call_ctx = AllocSetContextCreate(fcinfo->flinfo->fn_mcxt, "SRF multi-call context", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); /* * Allocate suitably long-lived space and zero it diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c index d35052aea6..bb835ba946 100644 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@ -327,9 +327,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags) CurrentDynaHashCxt = TopMemoryContext; CurrentDynaHashCxt = AllocSetContextCreate(CurrentDynaHashCxt, tabname, - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); } /* Initialize the hash header, plus a copy of the table name */ diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index d17197267e..824d5abf11 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -201,9 +201,7 @@ PerformAuthentication(Port *port) if (PostmasterContext == NULL) PostmasterContext = AllocSetContextCreate(TopMemoryContext, "Postmaster", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); if (!load_hba()) { diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l index 48052f9320..dae5015a32 100644 --- a/src/backend/utils/misc/guc-file.l +++ b/src/backend/utils/misc/guc-file.l @@ -145,9 +145,7 @@ ProcessConfigFile(GucContext context) */ config_cxt = AllocSetContextCreate(CurrentMemoryContext, "config file processing", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); caller_cxt = MemoryContextSwitchTo(config_cxt); /* diff --git a/src/backend/utils/misc/tzparser.c b/src/backend/utils/misc/tzparser.c index a960343baa..a053e22439 100644 --- a/src/backend/utils/misc/tzparser.c +++ b/src/backend/utils/misc/tzparser.c @@ -450,9 +450,7 @@ load_tzoffsets(const char *filename) */ tmpContext = AllocSetContextCreate(CurrentMemoryContext, "TZParserMemory", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); oldContext = MemoryContextSwitchTo(tmpContext); /* Initialize array at a reasonable size */ diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index d26991ed23..43c85234ce 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -427,10 +427,14 @@ randomize_mem(char *ptr, size_t size) * Create a new AllocSet context. * * parent: parent context, or NULL if top-level context - * name: name of context (for debugging --- string will be copied) + * name: name of context (for debugging only, need not be unique) * minContextSize: minimum context size * initBlockSize: initial allocation block size * maxBlockSize: maximum allocation block size + * + * Notes: the name string will be copied into context-lifespan storage. + * Most callers should abstract the context size parameters using a macro + * such as ALLOCSET_DEFAULT_SIZES. */ MemoryContext AllocSetContextCreate(MemoryContext parent, diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 6b7894213c..5cf388f9d6 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -91,16 +91,13 @@ MemoryContextInit(void) AssertState(TopMemoryContext == NULL); /* - * Initialize TopMemoryContext as an AllocSetContext with slow growth rate - * --- we don't really expect much to be allocated in it. - * - * (There is special-case code in MemoryContextCreate() for this call.) + * First, initialize TopMemoryContext, which will hold the MemoryContext + * nodes for all other contexts. (There is special-case code in + * MemoryContextCreate() to handle this call.) */ TopMemoryContext = AllocSetContextCreate((MemoryContext) NULL, "TopMemoryContext", - 0, - 8 * 1024, - 8 * 1024); + ALLOCSET_DEFAULT_SIZES); /* * Not having any other place to point CurrentMemoryContext, make it point diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index 425cae12ea..8286800380 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -108,9 +108,7 @@ EnablePortalManager(void) PortalMemory = AllocSetContextCreate(TopMemoryContext, "PortalMemory", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); ctl.keysize = MAX_PORTALNAME_LEN; ctl.entrysize = sizeof(PortalHashEnt); @@ -221,9 +219,7 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent) /* initialize portal heap context; typically it won't store much */ portal->heap = AllocSetContextCreate(PortalMemory, "PortalHeapMemory", - ALLOCSET_SMALL_MINSIZE, - ALLOCSET_SMALL_INITSIZE, - ALLOCSET_SMALL_MAXSIZE); + ALLOCSET_SMALL_SIZES); /* create a resource owner for the portal */ portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner, @@ -361,9 +357,7 @@ PortalCreateHoldStore(Portal portal) portal->holdContext = AllocSetContextCreate(PortalMemory, "PortalHoldContext", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); /* * Create the tuple store, selecting cross-transaction temp files, and diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index ae384a8546..c8fbcf8fcc 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -654,9 +654,7 @@ tuplesort_begin_common(int workMem, bool randomAccess) */ sortcontext = AllocSetContextCreate(CurrentMemoryContext, "TupleSort main", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); /* * Caller tuple (e.g. IndexTuple) memory context. @@ -669,9 +667,7 @@ tuplesort_begin_common(int workMem, bool randomAccess) */ tuplecontext = AllocSetContextCreate(sortcontext, "Caller tuples", - ALLOCSET_DEFAULT_MINSIZE, - ALLOCSET_DEFAULT_INITSIZE, - ALLOCSET_DEFAULT_MAXSIZE); + ALLOCSET_DEFAULT_SIZES); /* * Make the Tuplesortstate within the per-sort context. This way, we |
