mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 00:02:26 -04:00
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>
This commit is contained in:
parent
26fa446da6
commit
ea268cdc9a
@ -130,9 +130,7 @@ blbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
|||||||
initBloomState(&buildstate.blstate, index);
|
initBloomState(&buildstate.blstate, index);
|
||||||
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Bloom build temporary context",
|
"Bloom build temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
initCachedPage(&buildstate);
|
initCachedPage(&buildstate);
|
||||||
|
|
||||||
/* Do the heap scan */
|
/* Do the heap scan */
|
||||||
@ -204,9 +202,7 @@ blinsert(Relation index, Datum *values, bool *isnull,
|
|||||||
|
|
||||||
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
|
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Bloom insert temporary context",
|
"Bloom insert temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldCtx = MemoryContextSwitchTo(insertCtx);
|
oldCtx = MemoryContextSwitchTo(insertCtx);
|
||||||
|
|
||||||
|
@ -980,9 +980,7 @@ materializeQueryResult(FunctionCallInfo fcinfo,
|
|||||||
/* Create short-lived memory context for data conversions */
|
/* Create short-lived memory context for data conversions */
|
||||||
sinfo.tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
|
sinfo.tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"dblink temporary context",
|
"dblink temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* execute query, collecting any tuples into the tuplestore */
|
/* execute query, collecting any tuples into the tuplestore */
|
||||||
res = storeQueryResult(&sinfo, conn, sql);
|
res = storeQueryResult(&sinfo, conn, sql);
|
||||||
|
@ -1061,9 +1061,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
|
|||||||
*/
|
*/
|
||||||
tupcontext = AllocSetContextCreate(CurrentMemoryContext,
|
tupcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"file_fdw temporary context",
|
"file_fdw temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Prepare for sampling rows */
|
/* Prepare for sampling rows */
|
||||||
reservoir_init_selection_state(&rstate, targrows);
|
reservoir_init_selection_state(&rstate, targrows);
|
||||||
|
@ -529,9 +529,7 @@ createTrgmNFA(text *text_re, Oid collation,
|
|||||||
*/
|
*/
|
||||||
tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
|
tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"createTrgmNFA temporary context",
|
"createTrgmNFA temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcontext = MemoryContextSwitchTo(tmpcontext);
|
oldcontext = MemoryContextSwitchTo(tmpcontext);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1315,14 +1315,10 @@ postgresBeginForeignScan(ForeignScanState *node, int eflags)
|
|||||||
/* Create contexts for batches of tuples and per-tuple temp workspace. */
|
/* Create contexts for batches of tuples and per-tuple temp workspace. */
|
||||||
fsstate->batch_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
fsstate->batch_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
||||||
"postgres_fdw tuple data",
|
"postgres_fdw tuple data",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
fsstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
fsstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
||||||
"postgres_fdw temporary data",
|
"postgres_fdw temporary data",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get info we'll need for converting data fetched from the foreign server
|
* Get info we'll need for converting data fetched from the foreign server
|
||||||
@ -1695,9 +1691,7 @@ postgresBeginForeignModify(ModifyTableState *mtstate,
|
|||||||
/* Create context for per-tuple temp workspace. */
|
/* Create context for per-tuple temp workspace. */
|
||||||
fmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
fmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
||||||
"postgres_fdw temporary data",
|
"postgres_fdw temporary data",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/* Prepare for input conversion of RETURNING results. */
|
/* Prepare for input conversion of RETURNING results. */
|
||||||
if (fmstate->has_returning)
|
if (fmstate->has_returning)
|
||||||
@ -2294,9 +2288,7 @@ postgresBeginDirectModify(ForeignScanState *node, int eflags)
|
|||||||
/* Create context for per-tuple temp workspace. */
|
/* Create context for per-tuple temp workspace. */
|
||||||
dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
||||||
"postgres_fdw temporary data",
|
"postgres_fdw temporary data",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/* Prepare for input conversion of RETURNING results. */
|
/* Prepare for input conversion of RETURNING results. */
|
||||||
if (dmstate->has_returning)
|
if (dmstate->has_returning)
|
||||||
@ -3481,9 +3473,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
|
|||||||
astate.anl_cxt = CurrentMemoryContext;
|
astate.anl_cxt = CurrentMemoryContext;
|
||||||
astate.temp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
astate.temp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"postgres_fdw temporary data",
|
"postgres_fdw temporary data",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the connection to use. We do the remote access as the table's
|
* Get the connection to use. We do the remote access as the table's
|
||||||
|
@ -498,13 +498,11 @@ sepgsql_avc_init(void)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All the avc stuff shall be allocated on avc_mem_cxt
|
* All the avc stuff shall be allocated in avc_mem_cxt
|
||||||
*/
|
*/
|
||||||
avc_mem_cxt = AllocSetContextCreate(TopMemoryContext,
|
avc_mem_cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"userspace access vector cache",
|
"userspace access vector cache",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
memset(avc_slots, 0, sizeof(avc_slots));
|
memset(avc_slots, 0, sizeof(avc_slots));
|
||||||
avc_num_caches = 0;
|
avc_num_caches = 0;
|
||||||
avc_lru_hint = 0;
|
avc_lru_hint = 0;
|
||||||
|
@ -102,9 +102,7 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
|
|||||||
data = palloc0(sizeof(TestDecodingData));
|
data = palloc0(sizeof(TestDecodingData));
|
||||||
data->context = AllocSetContextCreate(ctx->context,
|
data->context = AllocSetContextCreate(ctx->context,
|
||||||
"text conversion context",
|
"text conversion context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
data->include_xids = true;
|
data->include_xids = true;
|
||||||
data->include_timestamp = false;
|
data->include_timestamp = false;
|
||||||
data->skip_empty_xacts = false;
|
data->skip_empty_xacts = false;
|
||||||
|
@ -165,9 +165,7 @@ brininsert(Relation idxRel, Datum *values, bool *nulls,
|
|||||||
bdesc = brin_build_desc(idxRel);
|
bdesc = brin_build_desc(idxRel);
|
||||||
tupcxt = AllocSetContextCreate(CurrentMemoryContext,
|
tupcxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"brininsert cxt",
|
"brininsert cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(tupcxt);
|
oldcxt = MemoryContextSwitchTo(tupcxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,9 +345,7 @@ bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
|
|||||||
*/
|
*/
|
||||||
perRangeCxt = AllocSetContextCreate(CurrentMemoryContext,
|
perRangeCxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"bringetbitmap cxt",
|
"bringetbitmap cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(perRangeCxt);
|
oldcxt = MemoryContextSwitchTo(perRangeCxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -856,9 +852,7 @@ brin_build_desc(Relation rel)
|
|||||||
|
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"brin desc cxt",
|
"brin desc cxt",
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(cxt);
|
oldcxt = MemoryContextSwitchTo(cxt);
|
||||||
tupdesc = RelationGetDescr(rel);
|
tupdesc = RelationGetDescr(rel);
|
||||||
|
|
||||||
@ -1169,9 +1163,7 @@ union_tuples(BrinDesc *bdesc, BrinMemTuple *a, BrinTuple *b)
|
|||||||
/* Use our own memory context to avoid retail pfree */
|
/* Use our own memory context to avoid retail pfree */
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"brin union",
|
"brin union",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(cxt);
|
oldcxt = MemoryContextSwitchTo(cxt);
|
||||||
db = brin_deform_tuple(bdesc, b);
|
db = brin_deform_tuple(bdesc, b);
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
|
@ -367,9 +367,7 @@ brin_new_memtuple(BrinDesc *brdesc)
|
|||||||
|
|
||||||
dtup->bt_context = AllocSetContextCreate(CurrentMemoryContext,
|
dtup->bt_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"brin dtuple",
|
"brin dtuple",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
return dtup;
|
return dtup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,9 +135,7 @@ printtup_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
|
|||||||
*/
|
*/
|
||||||
myState->tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
|
myState->tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"printtup",
|
"printtup",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3)
|
if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3)
|
||||||
{
|
{
|
||||||
|
@ -348,9 +348,7 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
|
|||||||
*/
|
*/
|
||||||
tmpCxt = AllocSetContextCreate(CurrentMemoryContext,
|
tmpCxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"ginPlaceToPage temporary context",
|
"ginPlaceToPage temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldCxt = MemoryContextSwitchTo(tmpCxt);
|
oldCxt = MemoryContextSwitchTo(tmpCxt);
|
||||||
|
|
||||||
if (GinPageIsData(page))
|
if (GinPageIsData(page))
|
||||||
|
@ -808,9 +808,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean,
|
|||||||
*/
|
*/
|
||||||
opCtx = AllocSetContextCreate(CurrentMemoryContext,
|
opCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"GIN insert cleanup temporary context",
|
"GIN insert cleanup temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldCtx = MemoryContextSwitchTo(opCtx);
|
oldCtx = MemoryContextSwitchTo(opCtx);
|
||||||
|
|
||||||
|
@ -372,9 +372,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
|||||||
*/
|
*/
|
||||||
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Gin build temporary context",
|
"Gin build temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a temporary memory context that is used for calling
|
* create a temporary memory context that is used for calling
|
||||||
@ -382,9 +380,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
|||||||
*/
|
*/
|
||||||
buildstate.funcCtx = AllocSetContextCreate(CurrentMemoryContext,
|
buildstate.funcCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Gin build temporary context for user-defined function",
|
"Gin build temporary context for user-defined function",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
buildstate.accum.ginstate = &buildstate.ginstate;
|
buildstate.accum.ginstate = &buildstate.ginstate;
|
||||||
ginInitBA(&buildstate.accum);
|
ginInitBA(&buildstate.accum);
|
||||||
@ -495,9 +491,7 @@ gininsert(Relation index, Datum *values, bool *isnull,
|
|||||||
|
|
||||||
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
|
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Gin insert temporary context",
|
"Gin insert temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldCtx = MemoryContextSwitchTo(insertCtx);
|
oldCtx = MemoryContextSwitchTo(insertCtx);
|
||||||
|
|
||||||
|
@ -38,14 +38,10 @@ ginbeginscan(Relation rel, int nkeys, int norderbys)
|
|||||||
so->nkeys = 0;
|
so->nkeys = 0;
|
||||||
so->tempCtx = AllocSetContextCreate(CurrentMemoryContext,
|
so->tempCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Gin scan temporary context",
|
"Gin scan temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
so->keyCtx = AllocSetContextCreate(CurrentMemoryContext,
|
so->keyCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Gin scan key context",
|
"Gin scan key context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
initGinState(&so->ginstate, scan->indexRelation);
|
initGinState(&so->ginstate, scan->indexRelation);
|
||||||
|
|
||||||
scan->opaque = so;
|
scan->opaque = so;
|
||||||
|
@ -526,9 +526,7 @@ ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
|
|||||||
|
|
||||||
gvs.tmpCxt = AllocSetContextCreate(CurrentMemoryContext,
|
gvs.tmpCxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Gin vacuum temporary context",
|
"Gin vacuum temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
gvs.index = index;
|
gvs.index = index;
|
||||||
gvs.callback = callback;
|
gvs.callback = callback;
|
||||||
gvs.callback_state = callback_state;
|
gvs.callback_state = callback_state;
|
||||||
|
@ -749,13 +749,12 @@ gin_xlog_startup(void)
|
|||||||
{
|
{
|
||||||
opCtx = AllocSetContextCreate(CurrentMemoryContext,
|
opCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"GIN recovery temporary context",
|
"GIN recovery temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gin_xlog_cleanup(void)
|
gin_xlog_cleanup(void)
|
||||||
{
|
{
|
||||||
MemoryContextDelete(opCtx);
|
MemoryContextDelete(opCtx);
|
||||||
|
opCtx = NULL;
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,7 @@ createTempGistContext(void)
|
|||||||
{
|
{
|
||||||
return AllocSetContextCreate(CurrentMemoryContext,
|
return AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"GiST temporary context",
|
"GiST temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1411,9 +1409,7 @@ initGISTstate(Relation index)
|
|||||||
/* Create the memory context that will hold the GISTSTATE */
|
/* Create the memory context that will hold the GISTSTATE */
|
||||||
scanCxt = AllocSetContextCreate(CurrentMemoryContext,
|
scanCxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"GiST scan context",
|
"GiST scan context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldCxt = MemoryContextSwitchTo(scanCxt);
|
oldCxt = MemoryContextSwitchTo(scanCxt);
|
||||||
|
|
||||||
/* Create and fill in the GISTSTATE */
|
/* Create and fill in the GISTSTATE */
|
||||||
|
@ -140,9 +140,7 @@ gistrescan(IndexScanDesc scan, ScanKey key, int nkeys,
|
|||||||
/* second time through */
|
/* second time through */
|
||||||
so->queueCxt = AllocSetContextCreate(so->giststate->scanCxt,
|
so->queueCxt = AllocSetContextCreate(so->giststate->scanCxt,
|
||||||
"GiST queue context",
|
"GiST queue context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
first_time = false;
|
first_time = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -180,9 +178,7 @@ gistrescan(IndexScanDesc scan, ScanKey key, int nkeys,
|
|||||||
|
|
||||||
so->pageDataCxt = AllocSetContextCreate(so->giststate->scanCxt,
|
so->pageDataCxt = AllocSetContextCreate(so->giststate->scanCxt,
|
||||||
"GiST page data context",
|
"GiST page data context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create new, empty RBTree for search queue */
|
/* create new, empty RBTree for search queue */
|
||||||
|
@ -258,9 +258,7 @@ begin_heap_rewrite(Relation old_heap, Relation new_heap, TransactionId oldest_xm
|
|||||||
*/
|
*/
|
||||||
rw_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
rw_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Table rewrite",
|
"Table rewrite",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
old_cxt = MemoryContextSwitchTo(rw_cxt);
|
old_cxt = MemoryContextSwitchTo(rw_cxt);
|
||||||
|
|
||||||
/* Create and fill in the state struct */
|
/* Create and fill in the state struct */
|
||||||
|
@ -763,9 +763,7 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
|
|||||||
/* Create a temporary memory context to run _bt_pagedel in */
|
/* Create a temporary memory context to run _bt_pagedel in */
|
||||||
vstate.pagedelcontext = AllocSetContextCreate(CurrentMemoryContext,
|
vstate.pagedelcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"_bt_pagedel",
|
"_bt_pagedel",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The outer loop iterates over all index pages except the metapage, in
|
* The outer loop iterates over all index pages except the metapage, in
|
||||||
|
@ -232,10 +232,8 @@ _bt_preprocess_array_keys(IndexScanDesc scan)
|
|||||||
*/
|
*/
|
||||||
if (so->arrayContext == NULL)
|
if (so->arrayContext == NULL)
|
||||||
so->arrayContext = AllocSetContextCreate(CurrentMemoryContext,
|
so->arrayContext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"BTree Array Context",
|
"BTree array context",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
else
|
else
|
||||||
MemoryContextReset(so->arrayContext);
|
MemoryContextReset(so->arrayContext);
|
||||||
|
|
||||||
|
@ -134,9 +134,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
|
|||||||
|
|
||||||
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SP-GiST build temporary context",
|
"SP-GiST build temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
reltuples = IndexBuildHeapScan(heap, index, indexInfo, true,
|
reltuples = IndexBuildHeapScan(heap, index, indexInfo, true,
|
||||||
spgistBuildCallback, (void *) &buildstate);
|
spgistBuildCallback, (void *) &buildstate);
|
||||||
@ -213,9 +211,7 @@ spginsert(Relation index, Datum *values, bool *isnull,
|
|||||||
|
|
||||||
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
|
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SP-GiST insert temporary context",
|
"SP-GiST insert temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldCtx = MemoryContextSwitchTo(insertCtx);
|
oldCtx = MemoryContextSwitchTo(insertCtx);
|
||||||
|
|
||||||
initSpGistState(&spgstate, index);
|
initSpGistState(&spgstate, index);
|
||||||
|
@ -193,9 +193,7 @@ spgbeginscan(Relation rel, int keysz, int orderbysz)
|
|||||||
initSpGistState(&so->state, scan->indexRelation);
|
initSpGistState(&so->state, scan->indexRelation);
|
||||||
so->tempCxt = AllocSetContextCreate(CurrentMemoryContext,
|
so->tempCxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SP-GiST search temporary context",
|
"SP-GiST search temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Set up indexTupDesc and xs_itupdesc in case it's an index-only scan */
|
/* Set up indexTupDesc and xs_itupdesc in case it's an index-only scan */
|
||||||
so->indexTupDesc = scan->xs_itupdesc = RelationGetDescr(rel);
|
so->indexTupDesc = scan->xs_itupdesc = RelationGetDescr(rel);
|
||||||
|
@ -1014,9 +1014,7 @@ spg_xlog_startup(void)
|
|||||||
{
|
{
|
||||||
opCtx = AllocSetContextCreate(CurrentMemoryContext,
|
opCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SP-GiST temporary context",
|
"SP-GiST temporary context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1570,10 +1570,8 @@ mXactCachePut(MultiXactId multi, int nmembers, MultiXactMember *members)
|
|||||||
/* The cache only lives as long as the current transaction */
|
/* The cache only lives as long as the current transaction */
|
||||||
debug_elog2(DEBUG2, "CachePut: initializing memory context");
|
debug_elog2(DEBUG2, "CachePut: initializing memory context");
|
||||||
MXactContext = AllocSetContextCreate(TopTransactionContext,
|
MXactContext = AllocSetContextCreate(TopTransactionContext,
|
||||||
"MultiXact Cache Context",
|
"MultiXact cache context",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = (mXactCacheEnt *)
|
entry = (mXactCacheEnt *)
|
||||||
|
@ -722,10 +722,8 @@ HandleParallelMessages(void)
|
|||||||
*/
|
*/
|
||||||
if (hpm_context == NULL) /* first time through? */
|
if (hpm_context == NULL) /* first time through? */
|
||||||
hpm_context = AllocSetContextCreate(TopMemoryContext,
|
hpm_context = AllocSetContextCreate(TopMemoryContext,
|
||||||
"HandleParallelMessages context",
|
"HandleParallelMessages",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
else
|
else
|
||||||
MemoryContextReset(hpm_context);
|
MemoryContextReset(hpm_context);
|
||||||
|
|
||||||
@ -962,10 +960,8 @@ ParallelWorkerMain(Datum main_arg)
|
|||||||
Assert(CurrentResourceOwner == NULL);
|
Assert(CurrentResourceOwner == NULL);
|
||||||
CurrentResourceOwner = ResourceOwnerCreate(NULL, "parallel toplevel");
|
CurrentResourceOwner = ResourceOwnerCreate(NULL, "parallel toplevel");
|
||||||
CurrentMemoryContext = AllocSetContextCreate(TopMemoryContext,
|
CurrentMemoryContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"parallel worker",
|
"Parallel worker",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that we have a resource owner, we can attach to the dynamic shared
|
* Now that we have a resource owner, we can attach to the dynamic shared
|
||||||
|
@ -1018,9 +1018,7 @@ AtStart_Memory(void)
|
|||||||
TopTransactionContext =
|
TopTransactionContext =
|
||||||
AllocSetContextCreate(TopMemoryContext,
|
AllocSetContextCreate(TopMemoryContext,
|
||||||
"TopTransactionContext",
|
"TopTransactionContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In a top-level transaction, CurTransactionContext is the same as
|
* In a top-level transaction, CurTransactionContext is the same as
|
||||||
@ -1078,9 +1076,7 @@ AtSubStart_Memory(void)
|
|||||||
*/
|
*/
|
||||||
CurTransactionContext = AllocSetContextCreate(CurTransactionContext,
|
CurTransactionContext = AllocSetContextCreate(CurTransactionContext,
|
||||||
"CurTransactionContext",
|
"CurTransactionContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
s->curTransactionContext = CurTransactionContext;
|
s->curTransactionContext = CurTransactionContext;
|
||||||
|
|
||||||
/* Make the CurTransactionContext active. */
|
/* Make the CurTransactionContext active. */
|
||||||
|
@ -4663,9 +4663,7 @@ XLOGShmemInit(void)
|
|||||||
{
|
{
|
||||||
walDebugCxt = AllocSetContextCreate(TopMemoryContext,
|
walDebugCxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"WAL Debug",
|
"WAL Debug",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextAllowInCriticalSection(walDebugCxt, true);
|
MemoryContextAllowInCriticalSection(walDebugCxt, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -997,9 +997,7 @@ InitXLogInsert(void)
|
|||||||
{
|
{
|
||||||
xloginsert_cxt = AllocSetContextCreate(TopMemoryContext,
|
xloginsert_cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"WAL record construction",
|
"WAL record construction",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registered_buffers == NULL)
|
if (registered_buffers == NULL)
|
||||||
|
@ -1069,9 +1069,7 @@ index_register(Oid heap,
|
|||||||
if (nogc == NULL)
|
if (nogc == NULL)
|
||||||
nogc = AllocSetContextCreate(NULL,
|
nogc = AllocSetContextCreate(NULL,
|
||||||
"BootstrapNoGC",
|
"BootstrapNoGC",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldcxt = MemoryContextSwitchTo(nogc);
|
oldcxt = MemoryContextSwitchTo(nogc);
|
||||||
|
|
||||||
|
@ -4747,9 +4747,7 @@ strlist_to_textarray(List *list)
|
|||||||
|
|
||||||
memcxt = AllocSetContextCreate(CurrentMemoryContext,
|
memcxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"strlist to array",
|
"strlist to array",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(memcxt);
|
oldcxt = MemoryContextSwitchTo(memcxt);
|
||||||
|
|
||||||
datums = palloc(sizeof(text *) * list_length(list));
|
datums = palloc(sizeof(text *) * list_length(list));
|
||||||
|
@ -332,9 +332,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params,
|
|||||||
*/
|
*/
|
||||||
anl_context = AllocSetContextCreate(CurrentMemoryContext,
|
anl_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Analyze",
|
"Analyze",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
caller_context = MemoryContextSwitchTo(anl_context);
|
caller_context = MemoryContextSwitchTo(anl_context);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -504,9 +502,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params,
|
|||||||
|
|
||||||
col_context = AllocSetContextCreate(anl_context,
|
col_context = AllocSetContextCreate(anl_context,
|
||||||
"Analyze Column",
|
"Analyze Column",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
old_context = MemoryContextSwitchTo(col_context);
|
old_context = MemoryContextSwitchTo(col_context);
|
||||||
|
|
||||||
for (i = 0; i < attr_cnt; i++)
|
for (i = 0; i < attr_cnt; i++)
|
||||||
@ -688,9 +684,7 @@ compute_index_stats(Relation onerel, double totalrows,
|
|||||||
|
|
||||||
ind_context = AllocSetContextCreate(anl_context,
|
ind_context = AllocSetContextCreate(anl_context,
|
||||||
"Analyze Index",
|
"Analyze Index",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
old_context = MemoryContextSwitchTo(ind_context);
|
old_context = MemoryContextSwitchTo(ind_context);
|
||||||
|
|
||||||
for (ind = 0; ind < nindexes; ind++)
|
for (ind = 0; ind < nindexes; ind++)
|
||||||
|
@ -204,9 +204,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
|
|||||||
*/
|
*/
|
||||||
cluster_context = AllocSetContextCreate(PortalContext,
|
cluster_context = AllocSetContextCreate(PortalContext,
|
||||||
"Cluster",
|
"Cluster",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build the list of relations to cluster. Note that this lives in
|
* Build the list of relations to cluster. Note that this lives in
|
||||||
|
@ -1340,9 +1340,7 @@ BeginCopy(bool is_from,
|
|||||||
*/
|
*/
|
||||||
cstate->copycontext = AllocSetContextCreate(CurrentMemoryContext,
|
cstate->copycontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"COPY",
|
"COPY",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldcontext = MemoryContextSwitchTo(cstate->copycontext);
|
oldcontext = MemoryContextSwitchTo(cstate->copycontext);
|
||||||
|
|
||||||
@ -1895,9 +1893,7 @@ CopyTo(CopyState cstate)
|
|||||||
*/
|
*/
|
||||||
cstate->rowcontext = AllocSetContextCreate(CurrentMemoryContext,
|
cstate->rowcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"COPY TO",
|
"COPY TO",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
if (cstate->binary)
|
if (cstate->binary)
|
||||||
{
|
{
|
||||||
|
@ -1018,9 +1018,7 @@ EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata)
|
|||||||
*/
|
*/
|
||||||
context = AllocSetContextCreate(CurrentMemoryContext,
|
context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"event trigger context",
|
"event trigger context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcontext = MemoryContextSwitchTo(context);
|
oldcontext = MemoryContextSwitchTo(context);
|
||||||
|
|
||||||
/* Call each event trigger. */
|
/* Call each event trigger. */
|
||||||
@ -1226,9 +1224,7 @@ EventTriggerBeginCompleteQuery(void)
|
|||||||
|
|
||||||
cxt = AllocSetContextCreate(TopMemoryContext,
|
cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"event trigger state",
|
"event trigger state",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
state = MemoryContextAlloc(cxt, sizeof(EventTriggerQueryState));
|
state = MemoryContextAlloc(cxt, sizeof(EventTriggerQueryState));
|
||||||
state->cxt = cxt;
|
state->cxt = cxt;
|
||||||
slist_init(&(state->SQLDropList));
|
slist_init(&(state->SQLDropList));
|
||||||
|
@ -1903,9 +1903,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
|
|||||||
*/
|
*/
|
||||||
private_context = AllocSetContextCreate(PortalContext,
|
private_context = AllocSetContextCreate(PortalContext,
|
||||||
"ReindexMultipleTables",
|
"ReindexMultipleTables",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define the search keys to find the objects to reindex. For a schema, we
|
* Define the search keys to find the objects to reindex. For a schema, we
|
||||||
|
@ -201,9 +201,7 @@ RelationBuildRowSecurity(Relation relation)
|
|||||||
*/
|
*/
|
||||||
rscxt = AllocSetContextCreate(CacheMemoryContext,
|
rscxt = AllocSetContextCreate(CacheMemoryContext,
|
||||||
"row security descriptor",
|
"row security descriptor",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since rscxt lives under CacheMemoryContext, it is long-lived. Use a
|
* Since rscxt lives under CacheMemoryContext, it is long-lived. Use a
|
||||||
|
@ -3339,9 +3339,7 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
|
|||||||
afterTriggers.event_cxt =
|
afterTriggers.event_cxt =
|
||||||
AllocSetContextCreate(TopTransactionContext,
|
AllocSetContextCreate(TopTransactionContext,
|
||||||
"AfterTriggerEvents",
|
"AfterTriggerEvents",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chunk size starts at 1KB and is allowed to increase up to 1MB.
|
* Chunk size starts at 1KB and is allowed to increase up to 1MB.
|
||||||
@ -3780,9 +3778,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events,
|
|||||||
per_tuple_context =
|
per_tuple_context =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"AfterTriggerTupleContext",
|
"AfterTriggerTupleContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
for_each_chunk(chunk, *events)
|
for_each_chunk(chunk, *events)
|
||||||
{
|
{
|
||||||
|
@ -209,9 +209,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
|
|||||||
*/
|
*/
|
||||||
vac_context = AllocSetContextCreate(PortalContext,
|
vac_context = AllocSetContextCreate(PortalContext,
|
||||||
"Vacuum",
|
"Vacuum",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If caller didn't give us a buffer strategy object, make one in the
|
* If caller didn't give us a buffer strategy object, make one in the
|
||||||
|
@ -80,9 +80,7 @@ CreateExecutorState(void)
|
|||||||
*/
|
*/
|
||||||
qcontext = AllocSetContextCreate(CurrentMemoryContext,
|
qcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"ExecutorState",
|
"ExecutorState",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the EState node within the per-query context. This way, we don't
|
* Make the EState node within the per-query context. This way, we don't
|
||||||
@ -229,9 +227,7 @@ CreateExprContext(EState *estate)
|
|||||||
econtext->ecxt_per_tuple_memory =
|
econtext->ecxt_per_tuple_memory =
|
||||||
AllocSetContextCreate(estate->es_query_cxt,
|
AllocSetContextCreate(estate->es_query_cxt,
|
||||||
"ExprContext",
|
"ExprContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
econtext->ecxt_param_exec_vals = estate->es_param_exec_vals;
|
econtext->ecxt_param_exec_vals = estate->es_param_exec_vals;
|
||||||
econtext->ecxt_param_list_info = estate->es_param_list_info;
|
econtext->ecxt_param_list_info = estate->es_param_list_info;
|
||||||
@ -300,9 +296,7 @@ CreateStandaloneExprContext(void)
|
|||||||
econtext->ecxt_per_tuple_memory =
|
econtext->ecxt_per_tuple_memory =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"ExprContext",
|
"ExprContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
econtext->ecxt_param_exec_vals = NULL;
|
econtext->ecxt_param_exec_vals = NULL;
|
||||||
econtext->ecxt_param_list_info = NULL;
|
econtext->ecxt_param_list_info = NULL;
|
||||||
|
@ -600,9 +600,7 @@ init_sql_fcache(FmgrInfo *finfo, Oid collation, bool lazyEvalOK)
|
|||||||
*/
|
*/
|
||||||
fcontext = AllocSetContextCreate(finfo->fn_mcxt,
|
fcontext = AllocSetContextCreate(finfo->fn_mcxt,
|
||||||
"SQL function data",
|
"SQL function data",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldcontext = MemoryContextSwitchTo(fcontext);
|
oldcontext = MemoryContextSwitchTo(fcontext);
|
||||||
|
|
||||||
|
@ -508,9 +508,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
|||||||
*/
|
*/
|
||||||
scanstate->argcontext = AllocSetContextCreate(CurrentMemoryContext,
|
scanstate->argcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Table function arguments",
|
"Table function arguments",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
return scanstate;
|
return scanstate;
|
||||||
}
|
}
|
||||||
|
@ -344,15 +344,11 @@ ExecHashTableCreate(Hash *node, List *hashOperators, bool keepNulls)
|
|||||||
*/
|
*/
|
||||||
hashtable->hashCxt = AllocSetContextCreate(CurrentMemoryContext,
|
hashtable->hashCxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"HashTableContext",
|
"HashTableContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
hashtable->batchCxt = AllocSetContextCreate(hashtable->hashCxt,
|
hashtable->batchCxt = AllocSetContextCreate(hashtable->hashCxt,
|
||||||
"HashBatchContext",
|
"HashBatchContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Allocate data that will live for the life of the hashjoin */
|
/* Allocate data that will live for the life of the hashjoin */
|
||||||
|
|
||||||
|
@ -200,15 +200,11 @@ ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags)
|
|||||||
rustate->tempContext =
|
rustate->tempContext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"RecursiveUnion",
|
"RecursiveUnion",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
rustate->tableContext =
|
rustate->tableContext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"RecursiveUnion hash table",
|
"RecursiveUnion hash table",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -507,9 +507,7 @@ ExecInitSetOp(SetOp *node, EState *estate, int eflags)
|
|||||||
setopstate->tempContext =
|
setopstate->tempContext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SetOp",
|
"SetOp",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If hashing, we also need a longer-lived context to store the hash
|
* If hashing, we also need a longer-lived context to store the hash
|
||||||
@ -520,9 +518,7 @@ ExecInitSetOp(SetOp *node, EState *estate, int eflags)
|
|||||||
setopstate->tableContext =
|
setopstate->tableContext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SetOp hash table",
|
"SetOp hash table",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tuple table initialization
|
* Tuple table initialization
|
||||||
|
@ -776,16 +776,12 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
|
|||||||
sstate->hashtablecxt =
|
sstate->hashtablecxt =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Subplan HashTable Context",
|
"Subplan HashTable Context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
/* and a small one for the hash tables to use as temp storage */
|
/* and a small one for the hash tables to use as temp storage */
|
||||||
sstate->hashtempcxt =
|
sstate->hashtempcxt =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Subplan HashTable Temp Context",
|
"Subplan HashTable Temp Context",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
/* and a short-lived exprcontext for function evaluation */
|
/* and a short-lived exprcontext for function evaluation */
|
||||||
sstate->innerecontext = CreateExprContext(estate);
|
sstate->innerecontext = CreateExprContext(estate);
|
||||||
/* Silly little array of column numbers 1..n */
|
/* Silly little array of column numbers 1..n */
|
||||||
|
@ -133,9 +133,7 @@ ExecInitUnique(Unique *node, EState *estate, int eflags)
|
|||||||
uniquestate->tempContext =
|
uniquestate->tempContext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Unique",
|
"Unique",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tuple table initialization
|
* Tuple table initialization
|
||||||
|
@ -1801,10 +1801,8 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
|
|||||||
/* Create long-lived context for storage of partition-local memory etc */
|
/* Create long-lived context for storage of partition-local memory etc */
|
||||||
winstate->partcontext =
|
winstate->partcontext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"WindowAgg_Partition",
|
"WindowAgg Partition",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create mid-lived context for aggregate trans values etc.
|
* Create mid-lived context for aggregate trans values etc.
|
||||||
@ -1814,10 +1812,8 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
|
|||||||
*/
|
*/
|
||||||
winstate->aggcontext =
|
winstate->aggcontext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"WindowAgg_Aggregates",
|
"WindowAgg Aggregates",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tuple table initialization
|
* tuple table initialization
|
||||||
@ -2321,10 +2317,8 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
|
|||||||
if (OidIsValid(invtransfn_oid))
|
if (OidIsValid(invtransfn_oid))
|
||||||
peraggstate->aggcontext =
|
peraggstate->aggcontext =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"WindowAgg_AggregatePrivate",
|
"WindowAgg Per Aggregate",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
else
|
else
|
||||||
peraggstate->aggcontext = winstate->aggcontext;
|
peraggstate->aggcontext = winstate->aggcontext;
|
||||||
|
|
||||||
|
@ -142,14 +142,10 @@ SPI_connect(void)
|
|||||||
*/
|
*/
|
||||||
_SPI_current->procCxt = AllocSetContextCreate(TopTransactionContext,
|
_SPI_current->procCxt = AllocSetContextCreate(TopTransactionContext,
|
||||||
"SPI Proc",
|
"SPI Proc",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
_SPI_current->execCxt = AllocSetContextCreate(TopTransactionContext,
|
_SPI_current->execCxt = AllocSetContextCreate(TopTransactionContext,
|
||||||
"SPI Exec",
|
"SPI Exec",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
/* ... and switch to procedure's context */
|
/* ... and switch to procedure's context */
|
||||||
_SPI_current->savedcxt = MemoryContextSwitchTo(_SPI_current->procCxt);
|
_SPI_current->savedcxt = MemoryContextSwitchTo(_SPI_current->procCxt);
|
||||||
|
|
||||||
@ -1744,9 +1740,7 @@ spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
|
|||||||
|
|
||||||
tuptabcxt = AllocSetContextCreate(CurrentMemoryContext,
|
tuptabcxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SPI TupTable",
|
"SPI TupTable",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(tuptabcxt);
|
MemoryContextSwitchTo(tuptabcxt);
|
||||||
|
|
||||||
_SPI_current->tuptable = tuptable = (SPITupleTable *)
|
_SPI_current->tuptable = tuptable = (SPITupleTable *)
|
||||||
@ -2615,14 +2609,11 @@ _SPI_make_plan_non_temp(SPIPlanPtr plan)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a memory context for the plan, underneath the procedure context.
|
* Create a memory context for the plan, underneath the procedure context.
|
||||||
* We don't expect the plan to be very large, so use smaller-than-default
|
* We don't expect the plan to be very large.
|
||||||
* alloc parameters.
|
|
||||||
*/
|
*/
|
||||||
plancxt = AllocSetContextCreate(parentcxt,
|
plancxt = AllocSetContextCreate(parentcxt,
|
||||||
"SPI Plan",
|
"SPI Plan",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(plancxt);
|
oldcxt = MemoryContextSwitchTo(plancxt);
|
||||||
|
|
||||||
/* Copy the SPI_plan struct and subsidiary data into the new context */
|
/* Copy the SPI_plan struct and subsidiary data into the new context */
|
||||||
@ -2689,9 +2680,7 @@ _SPI_save_plan(SPIPlanPtr plan)
|
|||||||
*/
|
*/
|
||||||
plancxt = AllocSetContextCreate(CurrentMemoryContext,
|
plancxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"SPI Plan",
|
"SPI Plan",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(plancxt);
|
oldcxt = MemoryContextSwitchTo(plancxt);
|
||||||
|
|
||||||
/* Copy the SPI plan into its own context */
|
/* Copy the SPI plan into its own context */
|
||||||
|
@ -281,9 +281,7 @@ tqueueReceiveSlot(TupleTableSlot *slot, DestReceiver *self)
|
|||||||
tqueue->tmpcontext =
|
tqueue->tmpcontext =
|
||||||
AllocSetContextCreate(tqueue->mycontext,
|
AllocSetContextCreate(tqueue->mycontext,
|
||||||
"tqueue sender temp context",
|
"tqueue sender temp context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcontext = MemoryContextSwitchTo(tqueue->tmpcontext);
|
oldcontext = MemoryContextSwitchTo(tqueue->tmpcontext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +79,7 @@ static MemoryContext fscxt = NULL;
|
|||||||
if (fscxt == NULL) \
|
if (fscxt == NULL) \
|
||||||
fscxt = AllocSetContextCreate(TopMemoryContext, \
|
fscxt = AllocSetContextCreate(TopMemoryContext, \
|
||||||
"Filesystem", \
|
"Filesystem", \
|
||||||
ALLOCSET_DEFAULT_MINSIZE, \
|
ALLOCSET_DEFAULT_SIZES); \
|
||||||
ALLOCSET_DEFAULT_INITSIZE, \
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -387,10 +387,8 @@ tokenize_file(const char *filename, FILE *file,
|
|||||||
MemoryContext oldcxt;
|
MemoryContext oldcxt;
|
||||||
|
|
||||||
linecxt = AllocSetContextCreate(CurrentMemoryContext,
|
linecxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"tokenize file cxt",
|
"tokenize_file",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(linecxt);
|
oldcxt = MemoryContextSwitchTo(linecxt);
|
||||||
|
|
||||||
*lines = *line_nums = NIL;
|
*lines = *line_nums = NIL;
|
||||||
@ -1817,9 +1815,7 @@ load_hba(void)
|
|||||||
Assert(PostmasterContext);
|
Assert(PostmasterContext);
|
||||||
hbacxt = AllocSetContextCreate(PostmasterContext,
|
hbacxt = AllocSetContextCreate(PostmasterContext,
|
||||||
"hba parser context",
|
"hba parser context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(hbacxt);
|
oldcxt = MemoryContextSwitchTo(hbacxt);
|
||||||
forthree(line, hba_lines, line_num, hba_line_nums, raw_line, hba_raw_lines)
|
forthree(line, hba_lines, line_num, hba_line_nums, raw_line, hba_raw_lines)
|
||||||
{
|
{
|
||||||
@ -2195,9 +2191,7 @@ load_ident(void)
|
|||||||
Assert(PostmasterContext);
|
Assert(PostmasterContext);
|
||||||
ident_context = AllocSetContextCreate(PostmasterContext,
|
ident_context = AllocSetContextCreate(PostmasterContext,
|
||||||
"ident parser context",
|
"ident parser context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(ident_context);
|
oldcxt = MemoryContextSwitchTo(ident_context);
|
||||||
forboth(line_cell, ident_lines, num_cell, ident_line_nums)
|
forboth(line_cell, ident_lines, num_cell, ident_line_nums)
|
||||||
{
|
{
|
||||||
|
@ -74,9 +74,7 @@ geqo_eval(PlannerInfo *root, Gene *tour, int num_gene)
|
|||||||
*/
|
*/
|
||||||
mycontext = AllocSetContextCreate(CurrentMemoryContext,
|
mycontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"GEQO",
|
"GEQO",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(mycontext);
|
oldcxt = MemoryContextSwitchTo(mycontext);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4378,9 +4378,7 @@ inline_function(Oid funcid, Oid result_type, Oid result_collid,
|
|||||||
*/
|
*/
|
||||||
mycxt = AllocSetContextCreate(CurrentMemoryContext,
|
mycxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"inline_function",
|
"inline_function",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(mycxt);
|
oldcxt = MemoryContextSwitchTo(mycxt);
|
||||||
|
|
||||||
/* Fetch the function body */
|
/* Fetch the function body */
|
||||||
@ -4896,9 +4894,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
|
|||||||
*/
|
*/
|
||||||
mycxt = AllocSetContextCreate(CurrentMemoryContext,
|
mycxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"inline_set_returning_function",
|
"inline_set_returning_function",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(mycxt);
|
oldcxt = MemoryContextSwitchTo(mycxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -462,9 +462,7 @@ AutoVacLauncherMain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
AutovacMemCxt = AllocSetContextCreate(TopMemoryContext,
|
AutovacMemCxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Autovacuum Launcher",
|
"Autovacuum Launcher",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(AutovacMemCxt);
|
MemoryContextSwitchTo(AutovacMemCxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -894,14 +892,10 @@ rebuild_database_list(Oid newdb)
|
|||||||
|
|
||||||
newcxt = AllocSetContextCreate(AutovacMemCxt,
|
newcxt = AllocSetContextCreate(AutovacMemCxt,
|
||||||
"AV dblist",
|
"AV dblist",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
tmpcxt = AllocSetContextCreate(newcxt,
|
tmpcxt = AllocSetContextCreate(newcxt,
|
||||||
"tmp AV dblist",
|
"tmp AV dblist",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(tmpcxt);
|
oldcxt = MemoryContextSwitchTo(tmpcxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1111,9 +1105,7 @@ do_start_worker(void)
|
|||||||
*/
|
*/
|
||||||
tmpcxt = AllocSetContextCreate(CurrentMemoryContext,
|
tmpcxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Start worker tmp cxt",
|
"Start worker tmp cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(tmpcxt);
|
oldcxt = MemoryContextSwitchTo(tmpcxt);
|
||||||
|
|
||||||
/* use fresh stats */
|
/* use fresh stats */
|
||||||
@ -1911,9 +1903,7 @@ do_autovacuum(void)
|
|||||||
*/
|
*/
|
||||||
AutovacMemCxt = AllocSetContextCreate(TopMemoryContext,
|
AutovacMemCxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"AV worker",
|
"AV worker",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(AutovacMemCxt);
|
MemoryContextSwitchTo(AutovacMemCxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2183,9 +2173,7 @@ do_autovacuum(void)
|
|||||||
*/
|
*/
|
||||||
PortalContext = AllocSetContextCreate(AutovacMemCxt,
|
PortalContext = AllocSetContextCreate(AutovacMemCxt,
|
||||||
"Autovacuum Portal",
|
"Autovacuum Portal",
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform operations on collected tables.
|
* Perform operations on collected tables.
|
||||||
|
@ -160,9 +160,7 @@ BackgroundWriterMain(void)
|
|||||||
*/
|
*/
|
||||||
bgwriter_context = AllocSetContextCreate(TopMemoryContext,
|
bgwriter_context = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Background Writer",
|
"Background Writer",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(bgwriter_context);
|
MemoryContextSwitchTo(bgwriter_context);
|
||||||
|
|
||||||
WritebackContextInit(&wb_context, &bgwriter_flush_after);
|
WritebackContextInit(&wb_context, &bgwriter_flush_after);
|
||||||
|
@ -245,9 +245,7 @@ CheckpointerMain(void)
|
|||||||
*/
|
*/
|
||||||
checkpointer_context = AllocSetContextCreate(TopMemoryContext,
|
checkpointer_context = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Checkpointer",
|
"Checkpointer",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(checkpointer_context);
|
MemoryContextSwitchTo(checkpointer_context);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4792,9 +4792,7 @@ pgstat_setup_memcxt(void)
|
|||||||
if (!pgStatLocalContext)
|
if (!pgStatLocalContext)
|
||||||
pgStatLocalContext = AllocSetContextCreate(TopMemoryContext,
|
pgStatLocalContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Statistics snapshot",
|
"Statistics snapshot",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -583,9 +583,7 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
PostmasterContext = AllocSetContextCreate(TopMemoryContext,
|
PostmasterContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Postmaster",
|
"Postmaster",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(PostmasterContext);
|
MemoryContextSwitchTo(PostmasterContext);
|
||||||
|
|
||||||
/* Initialize paths to installation files */
|
/* Initialize paths to installation files */
|
||||||
|
@ -142,9 +142,7 @@ WalWriterMain(void)
|
|||||||
*/
|
*/
|
||||||
walwriter_context = AllocSetContextCreate(TopMemoryContext,
|
walwriter_context = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Wal Writer",
|
"Wal Writer",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(walwriter_context);
|
MemoryContextSwitchTo(walwriter_context);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -127,10 +127,8 @@ StartupDecodingContext(List *output_plugin_options,
|
|||||||
slot = MyReplicationSlot;
|
slot = MyReplicationSlot;
|
||||||
|
|
||||||
context = AllocSetContextCreate(CurrentMemoryContext,
|
context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Logical Decoding Context",
|
"Logical decoding context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
old_context = MemoryContextSwitchTo(context);
|
old_context = MemoryContextSwitchTo(context);
|
||||||
ctx = palloc0(sizeof(LogicalDecodingContext));
|
ctx = palloc0(sizeof(LogicalDecodingContext));
|
||||||
|
|
||||||
|
@ -232,9 +232,7 @@ ReorderBufferAllocate(void)
|
|||||||
/* allocate memory in own context, to have better accountability */
|
/* allocate memory in own context, to have better accountability */
|
||||||
new_ctx = AllocSetContextCreate(CurrentMemoryContext,
|
new_ctx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"ReorderBuffer",
|
"ReorderBuffer",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
buffer =
|
buffer =
|
||||||
(ReorderBuffer *) MemoryContextAlloc(new_ctx, sizeof(ReorderBuffer));
|
(ReorderBuffer *) MemoryContextAlloc(new_ctx, sizeof(ReorderBuffer));
|
||||||
@ -2317,7 +2315,7 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
|||||||
|
|
||||||
if (write(fd, rb->outbuf, ondisk->size) != ondisk->size)
|
if (write(fd, rb->outbuf, ondisk->size) != ondisk->size)
|
||||||
{
|
{
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
|
|
||||||
CloseTransientFile(fd);
|
CloseTransientFile(fd);
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
|
@ -289,9 +289,7 @@ AllocateSnapshotBuilder(ReorderBuffer *reorder,
|
|||||||
/* allocate memory in own context, to have better accountability */
|
/* allocate memory in own context, to have better accountability */
|
||||||
context = AllocSetContextCreate(CurrentMemoryContext,
|
context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"snapshot builder context",
|
"snapshot builder context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcontext = MemoryContextSwitchTo(context);
|
oldcontext = MemoryContextSwitchTo(context);
|
||||||
|
|
||||||
builder = palloc0(sizeof(SnapBuild));
|
builder = palloc0(sizeof(SnapBuild));
|
||||||
|
@ -1309,9 +1309,7 @@ exec_replication_command(const char *cmd_string)
|
|||||||
|
|
||||||
cmd_context = AllocSetContextCreate(CurrentMemoryContext,
|
cmd_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Replication command context",
|
"Replication command context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
old_context = MemoryContextSwitchTo(cmd_context);
|
old_context = MemoryContextSwitchTo(cmd_context);
|
||||||
|
|
||||||
replication_scanner_init(cmd_string);
|
replication_scanner_init(cmd_string);
|
||||||
|
@ -511,9 +511,7 @@ GetLocalBufferStorage(void)
|
|||||||
LocalBufferContext =
|
LocalBufferContext =
|
||||||
AllocSetContextCreate(TopMemoryContext,
|
AllocSetContextCreate(TopMemoryContext,
|
||||||
"LocalBufferContext",
|
"LocalBufferContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Start with a 16-buffer request; subsequent ones double each time */
|
/* Start with a 16-buffer request; subsequent ones double each time */
|
||||||
num_bufs = Max(num_bufs_in_block * 2, 16);
|
num_bufs = Max(num_bufs_in_block * 2, 16);
|
||||||
|
@ -65,9 +65,7 @@ ResetUnloggedRelations(int op)
|
|||||||
*/
|
*/
|
||||||
tmpctx = AllocSetContextCreate(CurrentMemoryContext,
|
tmpctx = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"ResetUnloggedRelations",
|
"ResetUnloggedRelations",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldctx = MemoryContextSwitchTo(tmpctx);
|
oldctx = MemoryContextSwitchTo(tmpctx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -285,9 +285,7 @@ init_lwlock_stats(void)
|
|||||||
*/
|
*/
|
||||||
lwlock_stats_cxt = AllocSetContextCreate(TopMemoryContext,
|
lwlock_stats_cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"LWLock stats",
|
"LWLock stats",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextAllowInCriticalSection(lwlock_stats_cxt, true);
|
MemoryContextAllowInCriticalSection(lwlock_stats_cxt, true);
|
||||||
|
|
||||||
MemSet(&ctl, 0, sizeof(ctl));
|
MemSet(&ctl, 0, sizeof(ctl));
|
||||||
|
@ -208,9 +208,7 @@ mdinit(void)
|
|||||||
{
|
{
|
||||||
MdCxt = AllocSetContextCreate(TopMemoryContext,
|
MdCxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"MdSmgr",
|
"MdSmgr",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create pending-operations hashtable if we need it. Currently, we need
|
* Create pending-operations hashtable if we need it. Currently, we need
|
||||||
@ -231,10 +229,8 @@ mdinit(void)
|
|||||||
* practice.
|
* practice.
|
||||||
*/
|
*/
|
||||||
pendingOpsCxt = AllocSetContextCreate(MdCxt,
|
pendingOpsCxt = AllocSetContextCreate(MdCxt,
|
||||||
"Pending Ops Context",
|
"Pending ops context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextAllowInCriticalSection(pendingOpsCxt, true);
|
MemoryContextAllowInCriticalSection(pendingOpsCxt, true);
|
||||||
|
|
||||||
MemSet(&hash_ctl, 0, sizeof(hash_ctl));
|
MemSet(&hash_ctl, 0, sizeof(hash_ctl));
|
||||||
|
@ -1253,9 +1253,7 @@ exec_parse_message(const char *query_string, /* string to execute */
|
|||||||
unnamed_stmt_context =
|
unnamed_stmt_context =
|
||||||
AllocSetContextCreate(MessageContext,
|
AllocSetContextCreate(MessageContext,
|
||||||
"unnamed prepared statement",
|
"unnamed prepared statement",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcontext = MemoryContextSwitchTo(unnamed_stmt_context);
|
oldcontext = MemoryContextSwitchTo(unnamed_stmt_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3794,9 +3792,7 @@ PostgresMain(int argc, char *argv[],
|
|||||||
*/
|
*/
|
||||||
MessageContext = AllocSetContextCreate(TopMemoryContext,
|
MessageContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"MessageContext",
|
"MessageContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remember stand-alone backend startup time
|
* Remember stand-alone backend startup time
|
||||||
|
@ -92,9 +92,7 @@ NIStartBuild(IspellDict *Conf)
|
|||||||
*/
|
*/
|
||||||
Conf->buildCxt = AllocSetContextCreate(CurTransactionContext,
|
Conf->buildCxt = AllocSetContextCreate(CurTransactionContext,
|
||||||
"Ispell dictionary init context",
|
"Ispell dictionary init context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -63,9 +63,7 @@ expand_array(Datum arraydatum, MemoryContext parentcontext,
|
|||||||
*/
|
*/
|
||||||
objcxt = AllocSetContextCreate(parentcontext,
|
objcxt = AllocSetContextCreate(parentcontext,
|
||||||
"expanded array",
|
"expanded array",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Set up expanded array header */
|
/* Set up expanded array header */
|
||||||
eah = (ExpandedArrayHeader *)
|
eah = (ExpandedArrayHeader *)
|
||||||
|
@ -4957,9 +4957,7 @@ initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext)
|
|||||||
if (subcontext)
|
if (subcontext)
|
||||||
arr_context = AllocSetContextCreate(rcontext,
|
arr_context = AllocSetContextCreate(rcontext,
|
||||||
"accumArrayResult",
|
"accumArrayResult",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
astate = (ArrayBuildState *)
|
astate = (ArrayBuildState *)
|
||||||
MemoryContextAlloc(arr_context, sizeof(ArrayBuildState));
|
MemoryContextAlloc(arr_context, sizeof(ArrayBuildState));
|
||||||
@ -5161,9 +5159,7 @@ initArrayResultArr(Oid array_type, Oid element_type, MemoryContext rcontext,
|
|||||||
if (subcontext)
|
if (subcontext)
|
||||||
arr_context = AllocSetContextCreate(rcontext,
|
arr_context = AllocSetContextCreate(rcontext,
|
||||||
"accumArrayResultArr",
|
"accumArrayResultArr",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Note we initialize all fields to zero */
|
/* Note we initialize all fields to zero */
|
||||||
astate = (ArrayBuildStateArr *)
|
astate = (ArrayBuildStateArr *)
|
||||||
|
@ -1503,9 +1503,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
|
|||||||
|
|
||||||
tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"jsonb_each temporary cxt",
|
"jsonb_each temporary cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
it = JsonbIteratorInit(&jb->root);
|
it = JsonbIteratorInit(&jb->root);
|
||||||
|
|
||||||
@ -1641,9 +1639,7 @@ each_worker(FunctionCallInfo fcinfo, bool as_text)
|
|||||||
state->lex = lex;
|
state->lex = lex;
|
||||||
state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"json_each temporary cxt",
|
"json_each temporary cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
pg_parse_json(lex, sem);
|
pg_parse_json(lex, sem);
|
||||||
|
|
||||||
@ -1822,9 +1818,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
|
|||||||
|
|
||||||
tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"jsonb_array_elements temporary cxt",
|
"jsonb_array_elements temporary cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
it = JsonbIteratorInit(&jb->root);
|
it = JsonbIteratorInit(&jb->root);
|
||||||
|
|
||||||
@ -1962,9 +1956,7 @@ elements_worker(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
|
|||||||
state->lex = lex;
|
state->lex = lex;
|
||||||
state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"json_array_elements temporary cxt",
|
"json_array_elements temporary cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
pg_parse_json(lex, sem);
|
pg_parse_json(lex, sem);
|
||||||
|
|
||||||
|
@ -1455,10 +1455,8 @@ xml_memory_init(void)
|
|||||||
/* Create memory context if not there already */
|
/* Create memory context if not there already */
|
||||||
if (LibxmlContext == NULL)
|
if (LibxmlContext == NULL)
|
||||||
LibxmlContext = AllocSetContextCreate(TopMemoryContext,
|
LibxmlContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"LibxmlContext",
|
"Libxml context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/* Re-establish the callbacks even if already set */
|
/* Re-establish the callbacks even if already set */
|
||||||
xmlMemSetup(xml_pfree, xml_palloc, xml_repalloc, xml_pstrdup);
|
xmlMemSetup(xml_pfree, xml_palloc, xml_repalloc, xml_pstrdup);
|
||||||
|
4
src/backend/utils/cache/catcache.c
vendored
4
src/backend/utils/cache/catcache.c
vendored
@ -536,9 +536,7 @@ CreateCacheMemoryContext(void)
|
|||||||
if (!CacheMemoryContext)
|
if (!CacheMemoryContext)
|
||||||
CacheMemoryContext = AllocSetContextCreate(TopMemoryContext,
|
CacheMemoryContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"CacheMemoryContext",
|
"CacheMemoryContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
4
src/backend/utils/cache/evtcache.c
vendored
4
src/backend/utils/cache/evtcache.c
vendored
@ -105,9 +105,7 @@ BuildEventTriggerCache(void)
|
|||||||
EventTriggerCacheContext =
|
EventTriggerCacheContext =
|
||||||
AllocSetContextCreate(CacheMemoryContext,
|
AllocSetContextCreate(CacheMemoryContext,
|
||||||
"EventTriggerCache",
|
"EventTriggerCache",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
CacheRegisterSyscacheCallback(EVENTTRIGGEROID,
|
CacheRegisterSyscacheCallback(EVENTTRIGGEROID,
|
||||||
InvalidateEventCacheCallback,
|
InvalidateEventCacheCallback,
|
||||||
(Datum) 0);
|
(Datum) 0);
|
||||||
|
35
src/backend/utils/cache/plancache.c
vendored
35
src/backend/utils/cache/plancache.c
vendored
@ -159,15 +159,13 @@ CreateCachedPlan(Node *raw_parse_tree,
|
|||||||
/*
|
/*
|
||||||
* Make a dedicated memory context for the CachedPlanSource and its
|
* Make a dedicated memory context for the CachedPlanSource and its
|
||||||
* permanent subsidiary data. It's probably not going to be large, but
|
* permanent subsidiary data. It's probably not going to be large, but
|
||||||
* just in case, use the default maxsize parameter. Initially it's a
|
* just in case, allow it to grow large. Initially it's a child of the
|
||||||
* child of the caller's context (which we assume to be transient), so
|
* caller's context (which we assume to be transient), so that it will be
|
||||||
* that it will be cleaned up on error.
|
* cleaned up on error.
|
||||||
*/
|
*/
|
||||||
source_context = AllocSetContextCreate(CurrentMemoryContext,
|
source_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"CachedPlanSource",
|
"CachedPlanSource",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create and fill the CachedPlanSource struct within the new context.
|
* 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 */
|
/* Again, it's a good bet the querytree_context can be small */
|
||||||
querytree_context = AllocSetContextCreate(source_context,
|
querytree_context = AllocSetContextCreate(source_context,
|
||||||
"CachedPlanQuery",
|
"CachedPlanQuery",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(querytree_context);
|
MemoryContextSwitchTo(querytree_context);
|
||||||
querytree_list = (List *) copyObject(querytree_list);
|
querytree_list = (List *) copyObject(querytree_list);
|
||||||
}
|
}
|
||||||
@ -733,9 +729,7 @@ RevalidateCachedQuery(CachedPlanSource *plansource)
|
|||||||
*/
|
*/
|
||||||
querytree_context = AllocSetContextCreate(CurrentMemoryContext,
|
querytree_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"CachedPlanQuery",
|
"CachedPlanQuery",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcxt = MemoryContextSwitchTo(querytree_context);
|
oldcxt = MemoryContextSwitchTo(querytree_context);
|
||||||
|
|
||||||
qlist = (List *) copyObject(tlist);
|
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
|
* 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
|
* subsidiary data. (It's probably not going to be large, but just in
|
||||||
* case, use the default maxsize parameter. It's transient for the
|
* case, allow it to grow large. It's transient for the moment.) But for
|
||||||
* moment.) But for a one-shot plan, we just leave it in the caller's
|
* a one-shot plan, we just leave it in the caller's memory context.
|
||||||
* memory context.
|
|
||||||
*/
|
*/
|
||||||
if (!plansource->is_oneshot)
|
if (!plansource->is_oneshot)
|
||||||
{
|
{
|
||||||
plan_context = AllocSetContextCreate(CurrentMemoryContext,
|
plan_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"CachedPlan",
|
"CachedPlan",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy plan into the new context.
|
* Copy plan into the new context.
|
||||||
@ -1351,9 +1342,7 @@ CopyCachedPlan(CachedPlanSource *plansource)
|
|||||||
|
|
||||||
source_context = AllocSetContextCreate(CurrentMemoryContext,
|
source_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"CachedPlanSource",
|
"CachedPlanSource",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldcxt = MemoryContextSwitchTo(source_context);
|
oldcxt = MemoryContextSwitchTo(source_context);
|
||||||
|
|
||||||
@ -1384,9 +1373,7 @@ CopyCachedPlan(CachedPlanSource *plansource)
|
|||||||
|
|
||||||
querytree_context = AllocSetContextCreate(source_context,
|
querytree_context = AllocSetContextCreate(source_context,
|
||||||
"CachedPlanQuery",
|
"CachedPlanQuery",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_START_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(querytree_context);
|
MemoryContextSwitchTo(querytree_context);
|
||||||
newsource->query_list = (List *) copyObject(plansource->query_list);
|
newsource->query_list = (List *) copyObject(plansource->query_list);
|
||||||
newsource->relationOids = (List *) copyObject(plansource->relationOids);
|
newsource->relationOids = (List *) copyObject(plansource->relationOids);
|
||||||
|
18
src/backend/utils/cache/relcache.c
vendored
18
src/backend/utils/cache/relcache.c
vendored
@ -659,14 +659,11 @@ RelationBuildRuleLock(Relation relation)
|
|||||||
int maxlocks;
|
int maxlocks;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the private context. Parameters are set on the assumption that
|
* Make the private context. Assume it'll not contain much data.
|
||||||
* it'll probably not contain much data.
|
|
||||||
*/
|
*/
|
||||||
rulescxt = AllocSetContextCreate(CacheMemoryContext,
|
rulescxt = AllocSetContextCreate(CacheMemoryContext,
|
||||||
RelationGetRelationName(relation),
|
RelationGetRelationName(relation),
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
relation->rd_rulescxt = rulescxt;
|
relation->rd_rulescxt = rulescxt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1248,15 +1245,10 @@ RelationInitIndexAccessInfo(Relation relation)
|
|||||||
* Make the private context to hold index access info. The reason we need
|
* 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
|
* a context, and not just a couple of pallocs, is so that we won't leak
|
||||||
* any subsidiary info attached to fmgr lookup records.
|
* 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,
|
indexcxt = AllocSetContextCreate(CacheMemoryContext,
|
||||||
RelationGetRelationName(relation),
|
RelationGetRelationName(relation),
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
relation->rd_indexcxt = indexcxt;
|
relation->rd_indexcxt = indexcxt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4948,9 +4940,7 @@ load_relcache_init_file(bool shared)
|
|||||||
*/
|
*/
|
||||||
indexcxt = AllocSetContextCreate(CacheMemoryContext,
|
indexcxt = AllocSetContextCreate(CacheMemoryContext,
|
||||||
RelationGetRelationName(rel),
|
RelationGetRelationName(rel),
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
rel->rd_indexcxt = indexcxt;
|
rel->rd_indexcxt = indexcxt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
4
src/backend/utils/cache/ts_cache.c
vendored
4
src/backend/utils/cache/ts_cache.c
vendored
@ -295,9 +295,7 @@ lookup_ts_dictionary_cache(Oid dictId)
|
|||||||
/* Create private memory context the first time through */
|
/* Create private memory context the first time through */
|
||||||
saveCtx = AllocSetContextCreate(CacheMemoryContext,
|
saveCtx = AllocSetContextCreate(CacheMemoryContext,
|
||||||
NameStr(dict->dictname),
|
NameStr(dict->dictname),
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
8
src/backend/utils/cache/typcache.c
vendored
8
src/backend/utils/cache/typcache.c
vendored
@ -756,9 +756,7 @@ load_domaintype_info(TypeCacheEntry *typentry)
|
|||||||
|
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Domain constraints",
|
"Domain constraints",
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
dcc = (DomainConstraintCache *)
|
dcc = (DomainConstraintCache *)
|
||||||
MemoryContextAlloc(cxt, sizeof(DomainConstraintCache));
|
MemoryContextAlloc(cxt, sizeof(DomainConstraintCache));
|
||||||
dcc->constraints = NIL;
|
dcc->constraints = NIL;
|
||||||
@ -841,9 +839,7 @@ load_domaintype_info(TypeCacheEntry *typentry)
|
|||||||
|
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"Domain constraints",
|
"Domain constraints",
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
dcc = (DomainConstraintCache *)
|
dcc = (DomainConstraintCache *)
|
||||||
MemoryContextAlloc(cxt, sizeof(DomainConstraintCache));
|
MemoryContextAlloc(cxt, sizeof(DomainConstraintCache));
|
||||||
dcc->constraints = NIL;
|
dcc->constraints = NIL;
|
||||||
|
@ -73,9 +73,7 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
|
|||||||
*/
|
*/
|
||||||
multi_call_ctx = AllocSetContextCreate(fcinfo->flinfo->fn_mcxt,
|
multi_call_ctx = AllocSetContextCreate(fcinfo->flinfo->fn_mcxt,
|
||||||
"SRF multi-call context",
|
"SRF multi-call context",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate suitably long-lived space and zero it
|
* Allocate suitably long-lived space and zero it
|
||||||
|
@ -327,9 +327,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags)
|
|||||||
CurrentDynaHashCxt = TopMemoryContext;
|
CurrentDynaHashCxt = TopMemoryContext;
|
||||||
CurrentDynaHashCxt = AllocSetContextCreate(CurrentDynaHashCxt,
|
CurrentDynaHashCxt = AllocSetContextCreate(CurrentDynaHashCxt,
|
||||||
tabname,
|
tabname,
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the hash header, plus a copy of the table name */
|
/* Initialize the hash header, plus a copy of the table name */
|
||||||
|
@ -201,9 +201,7 @@ PerformAuthentication(Port *port)
|
|||||||
if (PostmasterContext == NULL)
|
if (PostmasterContext == NULL)
|
||||||
PostmasterContext = AllocSetContextCreate(TopMemoryContext,
|
PostmasterContext = AllocSetContextCreate(TopMemoryContext,
|
||||||
"Postmaster",
|
"Postmaster",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
if (!load_hba())
|
if (!load_hba())
|
||||||
{
|
{
|
||||||
|
@ -145,9 +145,7 @@ ProcessConfigFile(GucContext context)
|
|||||||
*/
|
*/
|
||||||
config_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
config_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"config file processing",
|
"config file processing",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
caller_cxt = MemoryContextSwitchTo(config_cxt);
|
caller_cxt = MemoryContextSwitchTo(config_cxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -450,9 +450,7 @@ load_tzoffsets(const char *filename)
|
|||||||
*/
|
*/
|
||||||
tmpContext = AllocSetContextCreate(CurrentMemoryContext,
|
tmpContext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"TZParserMemory",
|
"TZParserMemory",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
oldContext = MemoryContextSwitchTo(tmpContext);
|
oldContext = MemoryContextSwitchTo(tmpContext);
|
||||||
|
|
||||||
/* Initialize array at a reasonable size */
|
/* Initialize array at a reasonable size */
|
||||||
|
@ -427,10 +427,14 @@ randomize_mem(char *ptr, size_t size)
|
|||||||
* Create a new AllocSet context.
|
* Create a new AllocSet context.
|
||||||
*
|
*
|
||||||
* parent: parent context, or NULL if top-level 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
|
* minContextSize: minimum context size
|
||||||
* initBlockSize: initial allocation block size
|
* initBlockSize: initial allocation block size
|
||||||
* maxBlockSize: maximum 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
|
MemoryContext
|
||||||
AllocSetContextCreate(MemoryContext parent,
|
AllocSetContextCreate(MemoryContext parent,
|
||||||
|
@ -91,16 +91,13 @@ MemoryContextInit(void)
|
|||||||
AssertState(TopMemoryContext == NULL);
|
AssertState(TopMemoryContext == NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize TopMemoryContext as an AllocSetContext with slow growth rate
|
* First, initialize TopMemoryContext, which will hold the MemoryContext
|
||||||
* --- we don't really expect much to be allocated in it.
|
* nodes for all other contexts. (There is special-case code in
|
||||||
*
|
* MemoryContextCreate() to handle this call.)
|
||||||
* (There is special-case code in MemoryContextCreate() for this call.)
|
|
||||||
*/
|
*/
|
||||||
TopMemoryContext = AllocSetContextCreate((MemoryContext) NULL,
|
TopMemoryContext = AllocSetContextCreate((MemoryContext) NULL,
|
||||||
"TopMemoryContext",
|
"TopMemoryContext",
|
||||||
0,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
8 * 1024,
|
|
||||||
8 * 1024);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not having any other place to point CurrentMemoryContext, make it point
|
* Not having any other place to point CurrentMemoryContext, make it point
|
||||||
|
@ -108,9 +108,7 @@ EnablePortalManager(void)
|
|||||||
|
|
||||||
PortalMemory = AllocSetContextCreate(TopMemoryContext,
|
PortalMemory = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PortalMemory",
|
"PortalMemory",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
ctl.keysize = MAX_PORTALNAME_LEN;
|
ctl.keysize = MAX_PORTALNAME_LEN;
|
||||||
ctl.entrysize = sizeof(PortalHashEnt);
|
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 */
|
/* initialize portal heap context; typically it won't store much */
|
||||||
portal->heap = AllocSetContextCreate(PortalMemory,
|
portal->heap = AllocSetContextCreate(PortalMemory,
|
||||||
"PortalHeapMemory",
|
"PortalHeapMemory",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
|
|
||||||
/* create a resource owner for the portal */
|
/* create a resource owner for the portal */
|
||||||
portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner,
|
portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner,
|
||||||
@ -361,9 +357,7 @@ PortalCreateHoldStore(Portal portal)
|
|||||||
portal->holdContext =
|
portal->holdContext =
|
||||||
AllocSetContextCreate(PortalMemory,
|
AllocSetContextCreate(PortalMemory,
|
||||||
"PortalHoldContext",
|
"PortalHoldContext",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the tuple store, selecting cross-transaction temp files, and
|
* Create the tuple store, selecting cross-transaction temp files, and
|
||||||
|
@ -654,9 +654,7 @@ tuplesort_begin_common(int workMem, bool randomAccess)
|
|||||||
*/
|
*/
|
||||||
sortcontext = AllocSetContextCreate(CurrentMemoryContext,
|
sortcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"TupleSort main",
|
"TupleSort main",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Caller tuple (e.g. IndexTuple) memory context.
|
* Caller tuple (e.g. IndexTuple) memory context.
|
||||||
@ -669,9 +667,7 @@ tuplesort_begin_common(int workMem, bool randomAccess)
|
|||||||
*/
|
*/
|
||||||
tuplecontext = AllocSetContextCreate(sortcontext,
|
tuplecontext = AllocSetContextCreate(sortcontext,
|
||||||
"Caller tuples",
|
"Caller tuples",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the Tuplesortstate within the per-sort context. This way, we
|
* Make the Tuplesortstate within the per-sort context. This way, we
|
||||||
|
@ -142,14 +142,26 @@ extern MemoryContext AllocSetContextCreate(MemoryContext parent,
|
|||||||
#define ALLOCSET_DEFAULT_MINSIZE 0
|
#define ALLOCSET_DEFAULT_MINSIZE 0
|
||||||
#define ALLOCSET_DEFAULT_INITSIZE (8 * 1024)
|
#define ALLOCSET_DEFAULT_INITSIZE (8 * 1024)
|
||||||
#define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024)
|
#define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024)
|
||||||
|
#define ALLOCSET_DEFAULT_SIZES \
|
||||||
|
ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Recommended alloc parameters for "small" contexts that are not expected
|
* Recommended alloc parameters for "small" contexts that are never expected
|
||||||
* to contain much data (for example, a context to contain a query plan).
|
* to contain much data (for example, a context to contain a query plan).
|
||||||
*/
|
*/
|
||||||
#define ALLOCSET_SMALL_MINSIZE 0
|
#define ALLOCSET_SMALL_MINSIZE 0
|
||||||
#define ALLOCSET_SMALL_INITSIZE (1 * 1024)
|
#define ALLOCSET_SMALL_INITSIZE (1 * 1024)
|
||||||
#define ALLOCSET_SMALL_MAXSIZE (8 * 1024)
|
#define ALLOCSET_SMALL_MAXSIZE (8 * 1024)
|
||||||
|
#define ALLOCSET_SMALL_SIZES \
|
||||||
|
ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Recommended alloc parameters for contexts that should start out small,
|
||||||
|
* but might sometimes grow big.
|
||||||
|
*/
|
||||||
|
#define ALLOCSET_START_SMALL_SIZES \
|
||||||
|
ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Threshold above which a request in an AllocSet context is certain to be
|
* Threshold above which a request in an AllocSet context is certain to be
|
||||||
|
@ -3205,9 +3205,7 @@ plperl_return_next(SV *sv)
|
|||||||
current_call_data->tmp_cxt =
|
current_call_data->tmp_cxt =
|
||||||
AllocSetContextCreate(CurrentMemoryContext,
|
AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"PL/Perl return_next temporary cxt",
|
"PL/Perl return_next temporary cxt",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
old_cxt = MemoryContextSwitchTo(current_call_data->tmp_cxt);
|
old_cxt = MemoryContextSwitchTo(current_call_data->tmp_cxt);
|
||||||
@ -3460,9 +3458,7 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
|
|||||||
************************************************************/
|
************************************************************/
|
||||||
plan_cxt = AllocSetContextCreate(TopMemoryContext,
|
plan_cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PL/Perl spi_prepare query",
|
"PL/Perl spi_prepare query",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(plan_cxt);
|
MemoryContextSwitchTo(plan_cxt);
|
||||||
qdesc = (plperl_query_desc *) palloc0(sizeof(plperl_query_desc));
|
qdesc = (plperl_query_desc *) palloc0(sizeof(plperl_query_desc));
|
||||||
snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
|
snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
|
||||||
@ -3479,9 +3475,7 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
|
|||||||
************************************************************/
|
************************************************************/
|
||||||
work_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
work_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"PL/Perl spi_prepare workspace",
|
"PL/Perl spi_prepare workspace",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(work_cxt);
|
MemoryContextSwitchTo(work_cxt);
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
@ -340,9 +340,7 @@ do_compile(FunctionCallInfo fcinfo,
|
|||||||
*/
|
*/
|
||||||
func_cxt = AllocSetContextCreate(TopMemoryContext,
|
func_cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PL/pgSQL function context",
|
"PL/pgSQL function context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
plpgsql_compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
|
plpgsql_compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
|
||||||
|
|
||||||
function->fn_signature = format_procedure(fcinfo->flinfo->fn_oid);
|
function->fn_signature = format_procedure(fcinfo->flinfo->fn_oid);
|
||||||
@ -829,10 +827,8 @@ plpgsql_compile_inline(char *proc_source)
|
|||||||
* its own memory context, so it can be reclaimed easily.
|
* its own memory context, so it can be reclaimed easily.
|
||||||
*/
|
*/
|
||||||
func_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
func_cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"PL/pgSQL function context",
|
"PL/pgSQL inline code context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
plpgsql_compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
|
plpgsql_compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
|
||||||
|
|
||||||
function->fn_signature = pstrdup(func_name);
|
function->fn_signature = pstrdup(func_name);
|
||||||
|
@ -1092,9 +1092,7 @@ get_stmt_mcontext(PLpgSQL_execstate *estate)
|
|||||||
estate->stmt_mcontext =
|
estate->stmt_mcontext =
|
||||||
AllocSetContextCreate(estate->stmt_mcontext_parent,
|
AllocSetContextCreate(estate->stmt_mcontext_parent,
|
||||||
"PLpgSQL per-statement data",
|
"PLpgSQL per-statement data",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
}
|
}
|
||||||
return estate->stmt_mcontext;
|
return estate->stmt_mcontext;
|
||||||
}
|
}
|
||||||
@ -3479,9 +3477,7 @@ plpgsql_estate_setup(PLpgSQL_execstate *estate,
|
|||||||
{
|
{
|
||||||
shared_cast_context = AllocSetContextCreate(TopMemoryContext,
|
shared_cast_context = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PLpgSQL cast info",
|
"PLpgSQL cast info",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
memset(&ctl, 0, sizeof(ctl));
|
memset(&ctl, 0, sizeof(ctl));
|
||||||
ctl.keysize = sizeof(plpgsql_CastHashKey);
|
ctl.keysize = sizeof(plpgsql_CastHashKey);
|
||||||
ctl.entrysize = sizeof(plpgsql_CastHashEntry);
|
ctl.entrysize = sizeof(plpgsql_CastHashEntry);
|
||||||
|
@ -116,9 +116,7 @@ PLy_cursor_query(const char *query)
|
|||||||
cursor->closed = false;
|
cursor->closed = false;
|
||||||
cursor->mcxt = AllocSetContextCreate(TopMemoryContext,
|
cursor->mcxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PL/Python cursor context",
|
"PL/Python cursor context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
PLy_typeinfo_init(&cursor->result, cursor->mcxt);
|
PLy_typeinfo_init(&cursor->result, cursor->mcxt);
|
||||||
|
|
||||||
oldcontext = CurrentMemoryContext;
|
oldcontext = CurrentMemoryContext;
|
||||||
@ -210,9 +208,7 @@ PLy_cursor_plan(PyObject *ob, PyObject *args)
|
|||||||
cursor->closed = false;
|
cursor->closed = false;
|
||||||
cursor->mcxt = AllocSetContextCreate(TopMemoryContext,
|
cursor->mcxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PL/Python cursor context",
|
"PL/Python cursor context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
PLy_typeinfo_init(&cursor->result, cursor->mcxt);
|
PLy_typeinfo_init(&cursor->result, cursor->mcxt);
|
||||||
|
|
||||||
oldcontext = CurrentMemoryContext;
|
oldcontext = CurrentMemoryContext;
|
||||||
|
@ -315,9 +315,7 @@ plpython_inline_handler(PG_FUNCTION_ARGS)
|
|||||||
MemSet(&proc, 0, sizeof(PLyProcedure));
|
MemSet(&proc, 0, sizeof(PLyProcedure));
|
||||||
proc.mcxt = AllocSetContextCreate(TopMemoryContext,
|
proc.mcxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"__plpython_inline_block",
|
"__plpython_inline_block",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
proc.pyname = MemoryContextStrdup(proc.mcxt, "__plpython_inline_block");
|
proc.pyname = MemoryContextStrdup(proc.mcxt, "__plpython_inline_block");
|
||||||
proc.langid = codeblock->langOid;
|
proc.langid = codeblock->langOid;
|
||||||
proc.result.out.d.typoid = VOIDOID;
|
proc.result.out.d.typoid = VOIDOID;
|
||||||
@ -416,9 +414,7 @@ PLy_get_scratch_context(PLyExecutionContext *context)
|
|||||||
context->scratch_ctx =
|
context->scratch_ctx =
|
||||||
AllocSetContextCreate(TopTransactionContext,
|
AllocSetContextCreate(TopTransactionContext,
|
||||||
"PL/Python scratch context",
|
"PL/Python scratch context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
return context->scratch_ctx;
|
return context->scratch_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +167,7 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger)
|
|||||||
|
|
||||||
cxt = AllocSetContextCreate(TopMemoryContext,
|
cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
procName,
|
procName,
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
|
|
||||||
oldcxt = MemoryContextSwitchTo(cxt);
|
oldcxt = MemoryContextSwitchTo(cxt);
|
||||||
|
|
||||||
|
@ -66,9 +66,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
plan->mcxt = AllocSetContextCreate(TopMemoryContext,
|
plan->mcxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PL/Python plan context",
|
"PL/Python plan context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
oldcontext = MemoryContextSwitchTo(plan->mcxt);
|
oldcontext = MemoryContextSwitchTo(plan->mcxt);
|
||||||
|
|
||||||
nargs = list ? PySequence_Length(list) : 0;
|
nargs = list ? PySequence_Length(list) : 0;
|
||||||
@ -413,9 +411,7 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 rows, int status)
|
|||||||
|
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"PL/Python temp context",
|
"PL/Python temp context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
PLy_typeinfo_init(&args, cxt);
|
PLy_typeinfo_init(&args, cxt);
|
||||||
|
|
||||||
oldcontext = CurrentMemoryContext;
|
oldcontext = CurrentMemoryContext;
|
||||||
|
@ -756,9 +756,7 @@ PLyObject_ToComposite(PLyObToDatum *arg, int32 typmod, PyObject *plrv)
|
|||||||
/* Create a dummy PLyTypeInfo */
|
/* Create a dummy PLyTypeInfo */
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"PL/Python temp context",
|
"PL/Python temp context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemSet(&info, 0, sizeof(PLyTypeInfo));
|
MemSet(&info, 0, sizeof(PLyTypeInfo));
|
||||||
PLy_typeinfo_init(&info, cxt);
|
PLy_typeinfo_init(&info, cxt);
|
||||||
/* Mark it as needing output routines lookup */
|
/* Mark it as needing output routines lookup */
|
||||||
@ -923,9 +921,7 @@ PLyString_ToComposite(PLyTypeInfo *info, TupleDesc desc, PyObject *string)
|
|||||||
/* Create a dummy PLyTypeInfo */
|
/* Create a dummy PLyTypeInfo */
|
||||||
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
cxt = AllocSetContextCreate(CurrentMemoryContext,
|
||||||
"PL/Python temp context",
|
"PL/Python temp context",
|
||||||
ALLOCSET_DEFAULT_MINSIZE,
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
ALLOCSET_DEFAULT_INITSIZE,
|
|
||||||
ALLOCSET_DEFAULT_MAXSIZE);
|
|
||||||
MemSet(&locinfo, 0, sizeof(PLyTypeInfo));
|
MemSet(&locinfo, 0, sizeof(PLyTypeInfo));
|
||||||
PLy_typeinfo_init(&locinfo, cxt);
|
PLy_typeinfo_init(&locinfo, cxt);
|
||||||
|
|
||||||
|
@ -2331,9 +2331,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
|||||||
************************************************************/
|
************************************************************/
|
||||||
plan_cxt = AllocSetContextCreate(TopMemoryContext,
|
plan_cxt = AllocSetContextCreate(TopMemoryContext,
|
||||||
"PL/TCL spi_prepare query",
|
"PL/TCL spi_prepare query",
|
||||||
ALLOCSET_SMALL_MINSIZE,
|
ALLOCSET_SMALL_SIZES);
|
||||||
ALLOCSET_SMALL_INITSIZE,
|
|
||||||
ALLOCSET_SMALL_MAXSIZE);
|
|
||||||
MemoryContextSwitchTo(plan_cxt);
|
MemoryContextSwitchTo(plan_cxt);
|
||||||
qdesc = (pltcl_query_desc *) palloc0(sizeof(pltcl_query_desc));
|
qdesc = (pltcl_query_desc *) palloc0(sizeof(pltcl_query_desc));
|
||||||
snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
|
snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user