PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
palloc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MemoryContextCallback
 

Macros

#define MCXT_ALLOC_HUGE   0x01 /* allow huge allocation (> 1 GB) */
 
#define MCXT_ALLOC_NO_OOM   0x02 /* no failure if out-of-memory */
 
#define MCXT_ALLOC_ZERO   0x04 /* zero allocated memory */
 
#define palloc0fast(sz)
 

Typedefs

typedef struct MemoryContextDataMemoryContext
 
typedef void(* MemoryContextCallbackFunction )(void *arg)
 
typedef struct
MemoryContextCallback 
MemoryContextCallback
 

Functions

void * MemoryContextAlloc (MemoryContext context, Size size)
 
void * MemoryContextAllocZero (MemoryContext context, Size size)
 
void * MemoryContextAllocZeroAligned (MemoryContext context, Size size)
 
void * MemoryContextAllocExtended (MemoryContext context, Size size, int flags)
 
void * palloc (Size size)
 
void * palloc0 (Size size)
 
void * palloc_extended (Size size, int flags)
 
void * repalloc (void *pointer, Size size)
 
void pfree (void *pointer)
 
void * MemoryContextAllocHuge (MemoryContext context, Size size)
 
void * repalloc_huge (void *pointer, Size size)
 
static MemoryContext MemoryContextSwitchTo (MemoryContext context)
 
void MemoryContextRegisterResetCallback (MemoryContext context, MemoryContextCallback *cb)
 
char * MemoryContextStrdup (MemoryContext context, const char *string)
 
char * pstrdup (const char *in)
 
char * pnstrdup (const char *in, Size len)
 
char * pchomp (const char *in)
 
char * psprintf (const char *fmt,...) pg_attribute_printf(1
 
char size_t pvsnprintf (char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3
 

Variables

PGDLLIMPORT MemoryContext CurrentMemoryContext
 

Macro Definition Documentation

#define MCXT_ALLOC_HUGE   0x01 /* allow huge allocation (> 1 GB) */

Definition at line 64 of file palloc.h.

#define MCXT_ALLOC_NO_OOM   0x02 /* no failure if out-of-memory */

Definition at line 65 of file palloc.h.

#define MCXT_ALLOC_ZERO   0x04 /* zero allocated memory */

Definition at line 66 of file palloc.h.

#define palloc0fast (   sz)
Value:
( MemSetTest(0, sz) ? \
void * MemoryContextAllocZeroAligned(MemoryContext context, Size size)
Definition: mcxt.c:779
#define MemSetTest(val, len)
Definition: c.h:919
PGDLLIMPORT MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
void * MemoryContextAllocZero(MemoryContext context, Size size)
Definition: mcxt.c:742

Definition at line 91 of file palloc.h.

Typedef Documentation

Definition at line 36 of file palloc.h.

typedef void(* MemoryContextCallbackFunction)(void *arg)

Definition at line 45 of file palloc.h.

Function Documentation

void* MemoryContextAlloc ( MemoryContext  context,
Size  size 
)

Definition at line 707 of file mcxt.c.

References MemoryContextMethods::alloc, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MemoryContextIsValid, MemoryContextStats(), MemoryContextData::methods, NULL, and VALGRIND_MEMPOOL_ALLOC.

Referenced by _bt_getroot(), _bt_getrootheight(), _fdvec_resize(), _hash_getcachedmetap(), AddInvalidationMessage(), afterTriggerAddEvent(), AfterTriggerEnlargeQueryState(), array_fill_internal(), array_in(), array_out(), array_position_common(), array_positions(), array_recv(), array_send(), array_to_text_internal(), AtSubCommit_childXids(), BackendRun(), be_tls_open_server(), BuildArrayRemapInfo(), BuildFieldRemapInfo(), BuildRangeRemapInfo(), BuildTupleHashTable(), BuildTupleRemapInfo(), compute_array_stats(), copy_byval_expanded_array(), CopySnapshot(), copytup_index(), create_singleton_array(), dblink_connect(), dblink_init(), dense_alloc(), do_start_bgworker(), domain_state_setup(), dsm_create_descriptor(), dsm_impl_sysv(), DynaHashAlloc(), EventTriggerBeginCompleteQuery(), exec_eval_using_params(), ExecHashBuildSkewHash(), ExecHashSkewTableInsert(), ExecSetSlotDescriptor(), expand_array(), fetch_array_arg_replace_nulls(), fmgr_info_copy(), get_attribute_options(), get_range_io_data(), get_tablespace(), get_tabstat_stack_level(), GetComboCommandId(), GetFdwRoutineForRelation(), GetLocalBufferStorage(), GetLockConflicts(), gistAllocateNewPageBuffer(), gtrgm_consistent(), gtrgm_distance(), gtrgm_penalty(), hstore_from_record(), hstore_populate_record(), hypothetical_dense_rank_final(), initArrayResult(), initArrayResultAny(), initBloomState(), initialize_reloptions(), InitializeParallelDSM(), InitIndexAmRoutine(), InitXLogInsert(), insertStatEntry(), inv_open(), load_domaintype_info(), load_relcache_init_file(), LockAcquireExtended(), logical_rewrite_log_mapping(), lookup_hash_entry(), lookup_ts_config_cache(), makeBoolAggState(), MemoryContextCreate(), MemoryContextStrdup(), mXactCachePut(), on_dsm_detach(), packGraph(), PageSetChecksumCopy(), pg_column_size(), pg_stat_get_backend_idset(), pgstat_read_current_status(), plpgsql_create_econtext(), plpgsql_start_datums(), PLy_push_execution_context(), PLy_subtransaction_enter(), populate_record_worker(), populate_recordset_worker(), PortalSetResultFormat(), pq_init(), PrepareClientEncoding(), PrepareSortSupportComparisonShim(), PrepareTempTablespaces(), PushActiveSnapshot(), px_find_digest(), readtup_alloc(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_in(), record_out(), record_recv(), record_send(), RegisterExprContextCallback(), RegisterResourceReleaseCallback(), RegisterSubXactCallback(), RegisterXactCallback(), RelationBuildRuleLock(), RelationBuildTupleDesc(), RelationCreateStorage(), RelationDropStorage(), RelationParseRelOptions(), ReorderBufferAddInvalidations(), ReorderBufferAllocate(), ReorderBufferGetChange(), ReorderBufferGetTupleBuf(), ReorderBufferGetTXN(), ReorderBufferRestoreChange(), ReorderBufferSerializeReserve(), RequestNamedLWLockTranche(), ResourceArrayEnlarge(), RestoreSnapshot(), setop_fill_hash_table(), setup_background_workers(), shm_mq_receive(), SnapBuildFindSnapshot(), SnapBuildPurgeCommittedTxn(), SPI_connect(), SPI_palloc(), tbm_begin_iterate(), tstoreStartupReceiver(), txid_snapshot_xip(), and varstrfastcmp_locale().

708 {
709  void *ret;
710 
713 
714  if (!AllocSizeIsValid(size))
715  elog(ERROR, "invalid memory alloc request size %zu", size);
716 
717  context->isReset = false;
718 
719  ret = (*context->methods->alloc) (context, size);
720  if (ret == NULL)
721  {
723  ereport(ERROR,
724  (errcode(ERRCODE_OUT_OF_MEMORY),
725  errmsg("out of memory"),
726  errdetail("Failed on request of size %zu.", size)));
727  }
728 
729  VALGRIND_MEMPOOL_ALLOC(context, ret, size);
730 
731  return ret;
732 }
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void* MemoryContextAllocExtended ( MemoryContext  context,
Size  size,
int  flags 
)

Definition at line 813 of file mcxt.c.

References MemoryContextMethods::alloc, AllocHugeSizeIsValid, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MCXT_ALLOC_HUGE, MCXT_ALLOC_NO_OOM, MCXT_ALLOC_ZERO, MemoryContextIsValid, MemoryContextStats(), MemSetAligned, MemoryContextData::methods, NULL, and VALGRIND_MEMPOOL_ALLOC.

Referenced by heap_form_tuple(), and pagetable_allocate().

814 {
815  void *ret;
816 
819 
820  if (((flags & MCXT_ALLOC_HUGE) != 0 && !AllocHugeSizeIsValid(size)) ||
821  ((flags & MCXT_ALLOC_HUGE) == 0 && !AllocSizeIsValid(size)))
822  elog(ERROR, "invalid memory alloc request size %zu", size);
823 
824  context->isReset = false;
825 
826  ret = (*context->methods->alloc) (context, size);
827  if (ret == NULL)
828  {
829  if ((flags & MCXT_ALLOC_NO_OOM) == 0)
830  {
832  ereport(ERROR,
833  (errcode(ERRCODE_OUT_OF_MEMORY),
834  errmsg("out of memory"),
835  errdetail("Failed on request of size %zu.", size)));
836  }
837  return NULL;
838  }
839 
840  VALGRIND_MEMPOOL_ALLOC(context, ret, size);
841 
842  if ((flags & MCXT_ALLOC_ZERO) != 0)
843  MemSetAligned(ret, 0, size);
844 
845  return ret;
846 }
#define MemSetAligned(start, val, len)
Definition: c.h:890
#define MCXT_ALLOC_HUGE
Definition: fe_memutils.h:16
MemoryContextMethods * methods
Definition: memnodes.h:79
#define MCXT_ALLOC_NO_OOM
Definition: fe_memutils.h:18
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
#define MCXT_ALLOC_ZERO
Definition: fe_memutils.h:19
#define AllocHugeSizeIsValid(size)
Definition: memutils.h:46
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void* MemoryContextAllocHuge ( MemoryContext  context,
Size  size 
)

Definition at line 998 of file mcxt.c.

References MemoryContextMethods::alloc, AllocHugeSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MemoryContextIsValid, MemoryContextStats(), MemoryContextData::methods, NULL, and VALGRIND_MEMPOOL_ALLOC.

Referenced by pg_buffercache_pages().

999 {
1000  void *ret;
1001 
1002  AssertArg(MemoryContextIsValid(context));
1003  AssertNotInCriticalSection(context);
1004 
1005  if (!AllocHugeSizeIsValid(size))
1006  elog(ERROR, "invalid memory alloc request size %zu", size);
1007 
1008  context->isReset = false;
1009 
1010  ret = (*context->methods->alloc) (context, size);
1011  if (ret == NULL)
1012  {
1014  ereport(ERROR,
1015  (errcode(ERRCODE_OUT_OF_MEMORY),
1016  errmsg("out of memory"),
1017  errdetail("Failed on request of size %zu.", size)));
1018  }
1019 
1020  VALGRIND_MEMPOOL_ALLOC(context, ret, size);
1021 
1022  return ret;
1023 }
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
#define AllocHugeSizeIsValid(size)
Definition: memutils.h:46
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void* MemoryContextAllocZero ( MemoryContext  context,
Size  size 
)

Definition at line 742 of file mcxt.c.

References MemoryContextMethods::alloc, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MemoryContextIsValid, MemoryContextStats(), MemSetAligned, MemoryContextData::methods, NULL, and VALGRIND_MEMPOOL_ALLOC.

Referenced by add_tabstat_xact_level(), AfterTriggerEnlargeQueryState(), AllocateAttribute(), array_set_element_expanded(), CreatePortal(), CreateWaitEventSet(), do_compile(), ExecHashBuildSkewHash(), expandColorTrigrams(), fmgr_info_C_lang(), fmgr_security_definer(), get_tabstat_entry(), init_MultiFuncCall(), initArrayResultArr(), InitXLogInsert(), load_relcache_init_file(), LookupOpclassInfo(), make_sure_stat_tab_initialized(), newLOfd(), PLy_exec_function(), PLy_function_save_args(), PrepareInvalidationState(), push_old_value(), PushTransaction(), px_find_cipher(), RegisterLWLockTranches(), RehashCatCache(), RelationBuildRowSecurity(), RelationBuildTupleDesc(), RelationInitIndexAccessInfo(), ReorderBufferCopySnap(), ReorderBufferIterTXNInit(), ReorderBufferRestoreChange(), ResourceOwnerCreate(), SetConstraintStateCreate(), SnapBuildBuildSnapshot(), SnapBuildRestore(), SnapBuildSerialize(), spgGetCache(), ts_accum(), ts_stat_sql(), and WinGetPartitionLocalMemory().

743 {
744  void *ret;
745 
748 
749  if (!AllocSizeIsValid(size))
750  elog(ERROR, "invalid memory alloc request size %zu", size);
751 
752  context->isReset = false;
753 
754  ret = (*context->methods->alloc) (context, size);
755  if (ret == NULL)
756  {
758  ereport(ERROR,
759  (errcode(ERRCODE_OUT_OF_MEMORY),
760  errmsg("out of memory"),
761  errdetail("Failed on request of size %zu.", size)));
762  }
763 
764  VALGRIND_MEMPOOL_ALLOC(context, ret, size);
765 
766  MemSetAligned(ret, 0, size);
767 
768  return ret;
769 }
#define MemSetAligned(start, val, len)
Definition: c.h:890
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void* MemoryContextAllocZeroAligned ( MemoryContext  context,
Size  size 
)

Definition at line 779 of file mcxt.c.

References MemoryContextMethods::alloc, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MemoryContextIsValid, MemoryContextStats(), MemSetLoop, MemoryContextData::methods, NULL, and VALGRIND_MEMPOOL_ALLOC.

780 {
781  void *ret;
782 
785 
786  if (!AllocSizeIsValid(size))
787  elog(ERROR, "invalid memory alloc request size %zu", size);
788 
789  context->isReset = false;
790 
791  ret = (*context->methods->alloc) (context, size);
792  if (ret == NULL)
793  {
795  ereport(ERROR,
796  (errcode(ERRCODE_OUT_OF_MEMORY),
797  errmsg("out of memory"),
798  errdetail("Failed on request of size %zu.", size)));
799  }
800 
801  VALGRIND_MEMPOOL_ALLOC(context, ret, size);
802 
803  MemSetLoop(ret, 0, size);
804 
805  return ret;
806 }
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
#define MemSetLoop(start, val, len)
Definition: c.h:925
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void MemoryContextRegisterResetCallback ( MemoryContext  context,
MemoryContextCallback cb 
)

Definition at line 265 of file mcxt.c.

References AssertArg, MemoryContextData::isReset, MemoryContextIsValid, MemoryContextCallback::next, and MemoryContextData::reset_cbs.

Referenced by InitDomainConstraintRef(), and PLy_exec_function().

267 {
269 
270  /* Push onto head so this will be called before older registrants. */
271  cb->next = context->reset_cbs;
272  context->reset_cbs = cb;
273  /* Mark the context as non-reset (it probably is already). */
274  context->isReset = false;
275 }
MemoryContextCallback * reset_cbs
Definition: memnodes.h:85
#define AssertArg(condition)
Definition: c.h:677
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
struct MemoryContextCallback * next
Definition: palloc.h:51
char* MemoryContextStrdup ( MemoryContext  context,
const char *  string 
)

Definition at line 1064 of file mcxt.c.

References MemoryContextAlloc().

Referenced by _PG_init(), add_string_reloption(), AttrDefaultFetch(), BeginInternalSubTransaction(), cache_single_time(), CheckConstraintFetch(), DefineSavepoint(), exec_dynquery_with_params(), exec_stmt_dynexecute(), exec_stmt_raise(), ExecuteQuery(), internalerrquery(), mxid_to_string(), plpython_inline_handler(), PLy_cursor_plan(), PLy_cursor_query(), PLy_procedure_compile(), PrepareTransactionBlock(), pstrdup(), sepgsql_avc_unlabeled(), sepgsql_xact_callback(), set_errdata_field(), SetDatabasePath(), and SPI_cursor_open_internal().

1065 {
1066  char *nstr;
1067  Size len = strlen(string) + 1;
1068 
1069  nstr = (char *) MemoryContextAlloc(context, len);
1070 
1071  memcpy(nstr, string, len);
1072 
1073  return nstr;
1074 }
size_t Size
Definition: c.h:356
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition: mcxt.c:707
static MemoryContext MemoryContextSwitchTo ( MemoryContext  context)
inlinestatic

Definition at line 109 of file palloc.h.

References CurrentMemoryContext.

Referenced by _bt_preprocess_array_keys(), _SPI_execmem(), _SPI_make_plan_non_temp(), _SPI_procmem(), _SPI_save_plan(), accumArrayResult(), accumArrayResultArr(), aclexplode(), add_reloption(), advance_combine_function(), advance_transition_function(), advance_windowaggregate(), advance_windowaggregate_base(), AfterTriggerBeginSubXact(), allocate_reloption(), AllocateRelationDesc(), AllocateSnapshotBuilder(), analyze_row_processor(), apply_handle_delete(), apply_handle_insert(), apply_handle_update(), ApplyLauncherMain(), ApplyWorkerMain(), array_set_element_expanded(), array_unnest(), assign_record_type_typmod(), Async_Notify(), AtAbort_Memory(), AtCleanup_Memory(), AtCommit_Memory(), ATRewriteTable(), AtStart_Memory(), AtSubAbort_Memory(), AtSubCleanup_Memory(), AtSubCommit_Memory(), AtSubStart_Memory(), AtSubStart_Notify(), AutoVacLauncherMain(), BackendRun(), BackgroundWriterMain(), begin_heap_rewrite(), BeginCopy(), BeginCopyFrom(), BeginCopyTo(), blinsert(), bloomBuildCallback(), bpchar_sortsupport(), brin_build_desc(), brin_deform_tuple(), brin_page_items(), brin_revmap_data(), bringetbitmap(), brininsert(), brtuple_disk_tupdesc(), bt_check_level_from_leftmost(), bt_page_items(), btbpchar_pattern_sortsupport(), bttext_pattern_sortsupport(), bttextsortsupport(), btvacuumpage(), BuildCachedPlan(), BuildEventTriggerCache(), BuildHardcodedDescriptor(), buildSubPlanHash(), bytea_sortsupport(), cached_scansel(), CatalogCacheCreateEntry(), CatalogCacheInitializeCache(), CheckpointerMain(), combine_aggregates(), compile_plperl_function(), compile_pltcl_function(), CompleteCachedPlan(), compute_array_stats(), compute_distinct_stats(), compute_index_stats(), compute_range_stats(), compute_scalar_stats(), compute_tsvector_stats(), connectby(), connectby_text(), connectby_text_serial(), convert_prep_stmt_params(), convert_value_to_string(), ConvertTriggerToFK(), CopyCachedPlan(), CopyFrom(), CopyFromInsertBatch(), CopyOneRowTo(), copytup_cluster(), copytup_heap(), create_cursor(), create_join_clause(), create_unique_path(), CreateCachedPlan(), CreateDecodingContext(), CreateExecutorState(), CreateExprContext(), CreateInitDecodingContext(), CreateParallelContext(), CreateParallelContextForExternalFunction(), createTrgmNFA(), crosstab(), crosstab_hash(), dblink_get_notify(), dblink_get_pkey(), deconstruct_expanded_array(), deflist_to_tuplestore(), DiscreteKnapsack(), do_analyze_rel(), do_autovacuum(), do_compile(), do_numeric_accum(), do_numeric_discard(), do_start_bgworker(), do_start_worker(), domain_check_input(), DoPortalRewind(), dsnowball_lexize(), each_object_field_end(), each_worker(), each_worker_jsonb(), elements_array_element_end(), elements_worker(), elements_worker_jsonb(), elog_finish(), EmitErrorReport(), ensure_transaction(), errcontext_msg(), errdetail(), errdetail_internal(), errdetail_log(), errdetail_log_plural(), errdetail_params(), errdetail_plural(), errfinish(), errhint(), errmsg(), errmsg_internal(), errmsg_plural(), eval_windowaggregates(), eval_windowfunction(), EvalOrderByExpressions(), EvalPlanQualEnd(), EvalPlanQualNext(), EvalPlanQualStart(), evaluate_expr(), EventTriggerAlterTableStart(), EventTriggerCollectAlterDefPrivs(), EventTriggerCollectAlterOpFam(), EventTriggerCollectAlterTableSubcmd(), EventTriggerCollectAlterTSConfig(), EventTriggerCollectCreateOpClass(), EventTriggerCollectGrant(), EventTriggerCollectSimpleCommand(), EventTriggerInvoke(), EventTriggerSQLDropAddObject(), exec_assign_c_string(), exec_assign_value(), exec_bind_message(), exec_cast_value(), exec_describe_portal_message(), exec_describe_statement_message(), exec_eval_datum(), exec_eval_simple_expr(), exec_eval_using_params(), exec_init_tuple_store(), Exec_ListenCommit(), exec_parse_message(), exec_replication_command(), exec_simple_check_plan(), exec_simple_query(), exec_stmt_block(), exec_stmt_close(), exec_stmt_fetch(), exec_stmt_forc(), exec_stmt_foreach_a(), exec_stmt_getdiag(), exec_stmt_open(), exec_stmt_raise(), exec_stmt_return_next(), exec_stmt_return_query(), ExecCallTriggerFunc(), ExecCopySlot(), ExecEvalConvertRowtype(), ExecEvalExprSwitchContext(), ExecEvalWholeRowVar(), ExecFetchSlotMinimalTuple(), ExecGetTriggerResultRel(), ExecHashGetHashValue(), ExecHashIncreaseNumBatches(), ExecHashTableCreate(), ExecHashTableReset(), ExecIndexEvalArrayKeys(), ExecIndexEvalRuntimeKeys(), ExecMakeTableFunctionResult(), ExecMaterializeSlot(), ExecParallelRetrieveInstrumentation(), ExecPrepareCheck(), ExecPrepareExpr(), ExecPrepareQual(), ExecPrepareTuplestoreResult(), ExecRelCheck(), ExecScanSubPlan(), ExecSetParamPlan(), execTuplesMatch(), execTuplesUnequal(), ExecutorRewind(), expand_array(), explain_ExecutorStart(), ExportSnapshot(), fetch_array_arg_replace_nulls(), fetch_more_data(), file_acquire_sample_rows(), fill_hba_view(), finalize_aggregate(), finalize_partialaggregate(), finalize_windowaggregate(), FindTupleHashEntry(), fmgr_security_definer(), fmgr_sql(), ForeignNext(), format_elog_string(), format_expr_params(), format_preparedparamsdata(), gather_getnext(), generate_partition_qual(), generate_series_step_int4(), generate_series_step_int8(), generate_series_step_numeric(), generate_series_timestamp(), generate_series_timestamptz(), generate_subscripts(), geqo_eval(), get_actual_variable_range(), get_cast_hashentry(), get_database_list(), get_eclass_for_sort_expr(), get_qual_for_range(), get_rel_oids(), get_rel_sync_entry(), get_subscription_list(), get_tables_to_cluster(), GetOverrideSearchPath(), GetRelationPublicationActions(), GetTriggerTransitionTuplestore(), gin_leafpage_items(), gin_redo(), ginbuild(), ginBuildCallback(), ginHeapTupleBulkInsert(), gininsert(), ginInsertCleanup(), ginNewScanKey(), ginPlaceToPage(), ginVacuumPostingTreeLeaves(), gist_redo(), gistbeginscan(), gistbuild(), gistBuildCallback(), gistEmptyAllBuffers(), gistFetchTuple(), gistGetNodeBuffer(), gistgettuple(), gistinsert(), gistPushItupToNodeBuffer(), gistrescan(), gistScanPage(), gm_readnext_tuple(), HandleParallelMessages(), hash_page_items(), heap_page_items(), IdentifySystem(), index_register(), init_rel_sync_cache(), init_sexpr(), init_sql_fcache(), InitCatCache(), InitDeadLockChecking(), initGISTstate(), initialize_aggregate(), initialize_windowaggregate(), InitializeParallelDSM(), InitializeSearchPath(), initTrie(), inline_function(), inline_set_returning_function(), int8_avg_combine(), json_agg_transfn(), json_object_agg_transfn(), json_object_keys(), jsonb_agg_transfn(), jsonb_object_agg_transfn(), jsonb_object_keys(), keyGetItem(), LaunchParallelWorkers(), libpqrcv_processTuples(), load_categories_hash(), load_domaintype_info(), load_enum_cache_data(), load_hba(), load_ident(), load_tzoffsets(), logicalrep_rel_open(), logicalrep_relmap_update(), logicalrep_typmap_update(), LogicalRepApplyLoop(), lookup_ts_dictionary_cache(), LookupTupleHashEntry(), lowerstr_ctx(), make_canonical_pathkey(), make_datum_param(), make_tuple_from_result_row(), make_tuple_indirect(), makeArrayResultArr(), makeMdArrayResult(), makeNumericAggState(), makeStringAggState(), mark_dummy_rel(), materializeQueryResult(), materializeResult(), MJCompare(), MJEvalInnerValues(), MJEvalOuterValues(), normal_rand(), numeric_avg_combine(), numeric_combine(), numeric_poly_combine(), numeric_sortsupport(), operator_predicate_proof(), ordered_set_startup(), PerformCursorOpen(), PersistHoldablePortal(), pg_available_extension_versions(), pg_available_extensions(), pg_buffercache_pages(), pg_check_frozen(), pg_check_visible(), pg_config(), pg_cursor(), pg_decode_change(), pg_event_trigger_ddl_commands(), pg_event_trigger_dropped_objects(), pg_extension_update_paths(), pg_get_keywords(), pg_get_multixact_members(), pg_get_publication_tables(), pg_get_replication_slots(), pg_hba_file_rules(), pg_listening_channels(), pg_lock_status(), pg_logdir_ls(), pg_logical_slot_get_changes_guts(), pg_ls_dir(), pg_ls_dir_files(), pg_prepared_statement(), pg_prepared_xact(), pg_show_replication_origin_status(), pg_start_backup(), pg_stat_get_activity(), pg_stat_get_progress_info(), pg_stat_get_subscription(), pg_stat_get_wal_senders(), pg_stat_statements_internal(), pg_stop_backup_v2(), pg_tablespace_databases(), pg_timezone_abbrevs(), pg_timezone_names(), pg_visibility_map_rel(), pg_visibility_rel(), pgoutput_change(), pgp_armor_headers(), pgrowlocks(), pgss_ExecutorStart(), plperl_return_next(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), plpgsql_compile_inline(), plpgsql_create_econtext(), plpgsql_exec_function(), plpgsql_parse_cwordrowtype(), plpgsql_parse_cwordtype(), pltcl_elog(), pltcl_func_handler(), pltcl_init_tuple_store(), pltcl_SPI_prepare(), pltcl_subtrans_abort(), pltcl_subtrans_begin(), pltcl_subtrans_commit(), pltcl_subtransaction(), PLy_abort_open_subtransactions(), PLy_input_datum_func2(), PLy_input_tuple_funcs(), PLy_output(), PLy_output_datum_func2(), PLy_output_tuple_funcs(), PLy_procedure_create(), PLy_spi_execute_fetch_result(), PLy_spi_prepare(), PLy_spi_subtransaction_abort(), PLy_spi_subtransaction_begin(), PLy_spi_subtransaction_commit(), PLy_subtransaction_enter(), PLy_subtransaction_exit(), PLyDict_FromTuple(), PopTransaction(), populate_recordset_worker(), PortalCreateHoldStore(), PortalDrop(), PortalRun(), PortalRunFetch(), PortalRunUtility(), PortalStart(), PostgresMain(), PostmasterMain(), postquel_get_single_result(), prep_domain_constraints(), PrepareClientEncoding(), printtup(), printtup_20(), printtup_internal_20(), process_ordered_aggregate_single(), process_syncing_tables_for_apply(), ProcessCompletedNotifies(), ProcessStartupPacket(), prs_setup_firstcall(), publicationListToArray(), PushOverrideSearchPath(), queue_listen(), rebuild_database_list(), recomputeNamespacePath(), regexp_matches(), regexp_split_to_table(), register_label_provider(), register_on_commit_action(), regress_putenv(), ReindexMultipleTables(), RelationBuildLocalRelation(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationCacheInitializePhase2(), RelationCacheInitializePhase3(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexAttrBitmap(), RelationGetIndexExpressions(), RelationGetIndexList(), RelationGetIndexPredicate(), RelationGetStatExtList(), RelationInitIndexAccessInfo(), RelationSetIndexList(), ReleaseCurrentSubTransaction(), RememberFsyncRequest(), RememberToFreeTupleDescAtEOX(), ReorderBufferQueueMessage(), ReorderBufferToastReplace(), reorderqueue_push(), reread_subscription(), ResetUnloggedRelations(), ReThrowError(), RevalidateCachedQuery(), rewrite_heap_tuple(), roles_has_privs_of(), roles_is_member_of(), RunFromStore(), scanPendingInsert(), SearchCatCacheList(), send_feedback(), sepgsql_avc_compute(), sepgsql_fmgr_hook(), sepgsql_set_client_label(), setup_background_workers(), setup_firstcall(), show_all_file_settings(), show_all_settings(), ShutdownExprContext(), spg_box_quad_inner_consistent(), spg_range_quad_inner_consistent(), spg_redo(), spginsert(), spgistBuildCallback(), spgLeafTest(), spgWalk(), SPI_connect(), SPI_copytuple(), SPI_cursor_open_internal(), SPI_datumTransfer(), spi_dest_startup(), SPI_finish(), SPI_modifytuple(), spi_printtup(), SPI_returntuple(), spool_tuples(), ssl_extension_info(), standard_ExecutorEnd(), standard_ExecutorFinish(), standard_ExecutorRun(), standard_ExecutorStart(), StartChildProcess(), startScanKey(), StartTransactionCommand(), StartupDecodingContext(), store_flush_position(), storeRow(), strlist_to_textarray(), tfuncFetchRows(), tfuncLoadRows(), ThrowErrorData(), tokenize_file(), TQExamineRecord(), TQRemapRecord(), tqueueReceiveSlot(), TriggerEnabled(), ts_setup_firstcall(), tsquery_rewrite_query(), tstoreReceiveSlot_detoast(), tsvector_unnest(), tt_setup_firstcall(), tuplesort_begin_cluster(), tuplesort_begin_common(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_begin_index_btree(), tuplesort_begin_index_hash(), tuplesort_end(), tuplesort_getdatum(), tuplesort_getheaptuple(), tuplesort_getindextuple(), tuplesort_gettupleslot(), tuplesort_markpos(), tuplesort_performsort(), tuplesort_putdatum(), tuplesort_putheaptuple(), tuplesort_putindextuplevalues(), tuplesort_puttupleslot(), tuplesort_rescan(), tuplesort_restorepos(), tuplesort_skiptuples(), tuplestore_puttuple(), tuplestore_puttupleslot(), tuplestore_putvalues(), union_tuples(), uuid_sortsupport(), vacuum(), validateCheckConstraint(), ValuesNext(), WalWriterMain(), window_gettupleslot(), xactGetCommittedInvalidationMessages(), XLogInsertRecord(), xml_is_document(), and xpath_table().

110 {
112 
113  CurrentMemoryContext = context;
114  return old;
115 }
PGDLLIMPORT MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
void* palloc ( Size  size)

Definition at line 849 of file mcxt.c.

References MemoryContextMethods::alloc, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MemoryContextIsValid, MemoryContextStats(), MemoryContextData::methods, NULL, pg_malloc_internal(), and VALGRIND_MEMPOOL_ALLOC.

Referenced by _bt_blnewpage(), _bt_mkscankey(), _bt_mkscankey_nodata(), _bt_newroot(), _bt_preprocess_array_keys(), _bt_search(), _bt_uppershutdown(), _lca(), _ltree_compress(), _ltree_picksplit(), _metaphone(), _SPI_convert_params(), _SPI_make_plan_non_temp(), _SPI_save_plan(), AbsorbFsyncRequests(), accum_sum_copy(), accumArrayResultArr(), aclexplode(), aclitemin(), aclitemout(), aclmembers(), acquire_inherited_sample_rows(), add_exact_object_address_extra(), add_new_cell(), add_one_float8(), add_reloption(), add_rte_to_flat_rtable(), add_unique_group_var(), addArc(), addArcs(), addCompiledLexeme(), AddEnumLabel(), addItemsToLeaf(), addKey(), addKeyToQueue(), addNode(), addNorm(), addRangeClause(), addRangeTableEntryForFunction(), AddRelationNewConstraints(), addRTEtoQuery(), addWrd(), AfterTriggerBeginSubXact(), alloc_chromo(), alloc_city_table(), alloc_edge_table(), alloc_pool(), allocate_reloption(), AllocateRelationDesc(), AlterPolicy(), AlterSubscription_refresh(), anybit_typmodout(), anychar_typmodout(), array_cat(), array_create_iterator(), array_in(), array_map(), array_out(), array_recv(), array_replace_internal(), array_set_element(), array_typanalyze(), array_unnest(), arrayconst_startup_fn(), arrayexpr_startup_fn(), ArrayGetIntegerTypmods(), assign_record_type_typmod(), AssignTransactionId(), Async_Notify(), ATExecAddColumn(), ATExecColumnDefault(), ATRewriteTable(), attach_internal(), autoinc(), be_loread(), begin_heap_rewrite(), begin_tup_output_tupdesc(), BeginCopyFrom(), big5_to_euc_tw(), binary_decode(), binary_encode(), binaryheap_allocate(), BipartiteMatch(), bit_and(), bit_catenate(), bit_or(), bit_out(), bit_recv(), bitfromint4(), bitfromint8(), bitnot(), bits_to_text(), bitsetbit(), bitshiftleft(), bitshiftright(), bitsubstring(), bitxor(), blbeginscan(), blbuild(), blbuildempty(), bms_copy(), boolout(), BootStrapXLOG(), box_center(), box_circle(), box_construct(), box_copy(), box_diagonal(), box_in(), box_intersect(), box_poly(), box_recv(), boxes_bound_box(), bpchar(), bpchar_input(), bqarr_in(), bqarr_out(), brin_build_desc(), brin_copy_tuple(), brin_deform_tuple(), brin_form_tuple(), brin_page_items(), brin_revmap_data(), brinbeginscan(), brinbuild(), brinRevmapInitialize(), bt_check_every_level(), bt_page_items(), btbeginscan(), btbuild(), btbuildempty(), btgettuple(), btrescan(), BufferSync(), build_datatype(), build_dummy_tuple(), build_function_result_tupdesc_d(), build_minmax_path(), build_pertrans_for_aggref(), build_regtype_array(), build_row_from_class(), build_row_from_vars(), build_server_final_message(), build_server_first_message(), build_subplan(), build_tlist_index(), build_tlist_index_other_vars(), build_tuplestore_recursively(), BuildCachedPlan(), BuildSpeculativeIndexInfo(), BuildTupleFromCStrings(), bytea_catenate(), bytea_string_agg_finalfn(), byteain(), byteaout(), bytearecv(), byteatrim(), cached_scansel(), calc_distr(), calc_hist(), calc_hist_selectivity(), calc_word_similarity(), CatalogCacheCreateEntry(), catenate_stringinfo_string(), char_bpchar(), char_text(), charout(), check_foreign_key(), check_ident_usermap(), check_primary_key(), check_temp_tablespaces(), CheckAffix(), checkAllTheSame(), checkclass_str(), checkcondition_HL(), checkcondition_str(), CheckIndexCompatible(), checkSharedDependencies(), chkpass_out(), choose_bitmap_and(), chr(), cidout(), circle_box(), circle_center(), circle_copy(), circle_in(), circle_recv(), classify_index_clause_usage(), cleanup_tsquery_stopwords(), clone_parse_state(), close_pl(), close_ps(), collect_corrupt_items(), collectTSQueryValues(), commit_ts_desc(), commit_ts_redo(), compileTheLexeme(), compileTheSubstitute(), CompleteCachedPlan(), complex_add(), complex_in(), complex_recv(), compute_array_stats(), compute_distinct_stats(), compute_index_stats(), compute_range_stats(), compute_scalar_stats(), compute_tsvector_stats(), ComputeIndexAttrs(), computeLeafRecompressWALData(), concat_text(), connect_pg_server(), consider_groupingsets_paths(), convert_prep_stmt_params(), convert_requires_to_datum(), convert_string_datum(), convert_tuples_by_name(), convert_tuples_by_position(), copy_file(), copy_heap_data(), copy_partition_key(), copy_pathtarget(), copy_plpgsql_datum(), copy_relation_data(), CopyCachedPlan(), CopyErrorData(), CopyFrom(), CopyIndexTuple(), CopyOverrideSearchPath(), copyParamList(), copytext(), CopyTo(), CopyTriggerDesc(), copyTSLexeme(), copyVar(), CopyVar(), count_usable_fds(), cr_circle(), create_internal(), create_mergejoin_plan(), create_unique_plan(), CreateConstraintEntry(), CreateCopyDestReceiver(), CreateFunction(), createPostingTree(), CreateQueryDesc(), CreateTemplateTupleDesc(), CreateTrigger(), CreateTupleDesc(), CreateTupleDescCopyConstr(), cstring_to_text_with_len(), current_database(), current_schemas(), currtid_byrelname(), currtid_byreloid(), dataBeginPlaceToPageLeaf(), dataPrepareDownlink(), datetime_to_char_body(), datumCopy(), datumRestore(), dblink_get_pkey(), debackslash(), decodePageSplitRecord(), DecodeTextArrayToCString(), DecodeXLogRecord(), deconstruct_array(), deconstruct_indexquals(), DefineIndex(), DefineRelation(), deserialize_deflist(), disassembleLeaf(), DiscreteKnapsack(), distribute_qual_to_rels(), do_analyze_rel(), do_compile(), do_pg_start_backup(), do_pg_stop_backup(), do_to_timestamp(), doPickSplit(), dotrim(), downcase_convert(), downcase_identifier(), DropRelFileNodesAllBuffers(), dsynonym_init(), dumpFunc(), dxsyn_lexize(), encrypt_password(), entry_dealloc(), entryPrepareDownlink(), enum_range_internal(), EnumValuesCreate(), euc_tw_to_big5(), EvalPlanQualStart(), EvaluateParams(), EventTriggerAlterTableStart(), EventTriggerCollectAlterOpFam(), EventTriggerCollectAlterTableSubcmd(), EventTriggerCollectAlterTSConfig(), EventTriggerCollectGrant(), EventTriggerCollectSimpleCommand(), examine_attribute(), exec_bind_message(), ExecEvalArrayExpr(), ExecGather(), ExecGatherMerge(), ExecHashJoinGetSavedTuple(), ExecHashTableCreate(), ExecIndexBuildScanKeys(), ExecInitAgg(), ExecInitCoerceToDomain(), ExecInitExprRec(), ExecInitFunctionScan(), ExecInitIndexScan(), ExecInitJunkFilter(), ExecInitProjectSet(), ExecInitSubPlan(), ExecInitTableFuncScan(), ExecInitValuesScan(), ExecMakeTableFunctionResult(), ExecOpenIndices(), ExecParallelRetrieveInstrumentation(), ExecParallelSetupTupleQueues(), ExecRelCheck(), ExecSetupPartitionTupleRouting(), execTuplesHashPrepare(), execTuplesMatchPrepare(), ExecuteTruncate(), expand_grouping_sets(), ExprEvalPushStep(), extract_autovac_opts(), extract_grouping_cols(), extract_grouping_ops(), extract_mb_char(), extract_rollup_sets(), fallbackSplit(), file_acquire_sample_rows(), fileBeginForeignScan(), fileGetForeignRelSize(), filter_list_to_array(), find_hash_columns(), find_in_dynamic_libpath(), find_inheritance_children(), find_window_functions(), findJsonbValueFromContainer(), float4_to_char(), Float4GetDatum(), float4out(), float8_to_char(), Float8GetDatum(), float8out_internal(), format_operator_internal(), format_procedure_internal(), formTextDatum(), FreezeMultiXactId(), fsm_extend(), FuncnameGetCandidates(), funny_dup17(), g_cube_decompress(), g_cube_picksplit(), g_int_compress(), g_int_decompress(), g_int_picksplit(), g_intbig_compress(), g_intbig_picksplit(), g_intbig_union(), gather_merge_init(), gbt_bit_xfrm(), gbt_cash_union(), gbt_date_union(), gbt_enum_union(), gbt_float4_union(), gbt_float8_union(), gbt_inet_compress(), gbt_inet_union(), gbt_int2_union(), gbt_int4_union(), gbt_int8_union(), gbt_intv_compress(), gbt_intv_decompress(), gbt_intv_union(), gbt_num_compress(), gbt_num_fetch(), gbt_num_picksplit(), gbt_oid_union(), gbt_time_union(), gbt_timetz_compress(), gbt_ts_union(), gbt_tstz_compress(), gbt_uuid_compress(), gbt_uuid_union(), gbt_var_compress(), gbt_var_decompress(), gbt_var_fetch(), gbt_var_key_from_datum(), gbt_var_picksplit(), generate_append_tlist(), generate_normalized_query(), generate_series_step_int4(), generate_series_step_int8(), generate_series_step_numeric(), generate_series_timestamp(), generate_series_timestamptz(), generate_subscripts(), generate_trgm(), generate_trgm_only(), generate_wildcard_trgm(), generateHeadline(), generator_init(), genericPickSplit(), GenericXLogStart(), geo_distance(), get_attribute_options(), get_attstatsslot(), get_column_info_for_window(), get_configdata(), get_controlfile(), get_crosstab_tuplestore(), get_database_list(), get_docrep(), get_ext_ver_info(), get_extension_aux_control_filename(), get_extension_control_directory(), get_extension_control_filename(), get_extension_script_directory(), get_extension_script_filename(), get_func_arg_info(), get_func_input_arg_names(), get_func_signature(), get_func_trftypes(), get_op_btree_interpretation(), get_page_from_raw(), get_path_all(), get_pkey_attnames(), get_raw_page_internal(), get_relation_info(), get_rels_with_domain(), get_str_from_var(), get_str_from_var_sci(), get_subscription_list(), get_tables_to_cluster(), get_text_array_contents(), get_tsearch_config_filename(), get_val(), get_worker(), GetBlockerStatusData(), GetBulkInsertState(), getColorInfo(), GetCurrentVirtualXIDs(), GetFdwRoutineForRelation(), GetForeignDataWrapper(), GetForeignServer(), GetForeignTable(), getIthJsonbValueFromContainer(), GetLockStatusData(), GetMultiXactIdMembers(), GetPredicateLockStatusData(), GetPreparedTransactionList(), GetPublication(), getRangeBox(), GetRelationPublicationActions(), GetRunningTransactionLocks(), GetSQLCurrentTime(), GetSubscription(), GetSubscriptionNotReadyRelations(), GetSubscriptionRelations(), gettoken_tsvector(), getTokenTypes(), GetUserMapping(), GetVirtualXIDsDelayingChkpt(), ghstore_compress(), ghstore_picksplit(), ghstore_union(), gimme_tree(), gin_bool_consistent(), gin_btree_extract_query(), gin_btree_extract_value(), gin_extract_hstore(), gin_extract_hstore_query(), gin_extract_jsonb(), gin_extract_jsonb_path(), gin_extract_jsonb_query(), gin_extract_query_trgm(), gin_extract_tsquery(), gin_extract_tsvector(), gin_extract_value_trgm(), gin_leafpage_items(), gin_trgm_triconsistent(), ginAllocEntryAccumulator(), ginbeginscan(), ginbuild(), ginCompressPostingList(), GinDataLeafPageGetItems(), ginExtractEntries(), ginFillScanEntry(), ginFillScanKey(), ginFindLeafPage(), ginFindParents(), GinFormInteriorTuple(), ginHeapTupleFastCollect(), ginHeapTupleFastInsert(), gininsert(), ginInsertBAEntry(), ginint4_queryextract(), ginMergeItemPointers(), ginNewScanKey(), ginPostingListDecodeAllSegments(), ginReadTuple(), ginVacuumItemPointers(), ginVacuumPostingTreeLeaf(), ginVacuumPostingTreeLeaves(), gist_box_picksplit(), gist_box_union(), gist_circle_compress(), gist_point_compress(), gist_point_fetch(), gist_poly_compress(), gistbeginscan(), gistbufferinginserttuples(), gistbuild(), gistbulkdelete(), gistextractpage(), gistfillitupvec(), gistfixsplit(), gistGetItupFromPage(), gistgettuple(), gistInitBuildBuffers(), gistMakeUnionItVec(), gistplacetopage(), gistRelocateBuildBuffersOnSplit(), gistrescan(), gistScanPage(), gistSplit(), gistSplitByKey(), gistSplitHalf(), gistunionsubkeyvec(), gseg_picksplit(), gtrgm_compress(), gtrgm_consistent(), gtrgm_decompress(), gtrgm_picksplit(), gtrgm_union(), gtsquery_compress(), gtsquery_picksplit(), gtsvector_compress(), gtsvector_decompress(), gtsvector_picksplit(), gtsvector_union(), gtsvectorout(), hash_object_field_end(), hash_page_items(), hashbeginscan(), hashbuild(), hashgettuple(), heap_beginscan_internal(), heap_copy_minimal_tuple(), heap_copy_tuple_as_datum(), heap_copytuple(), heap_copytuple_with_tuple(), heap_modify_tuple(), heap_modify_tuple_by_cols(), heap_multi_insert(), heap_page_items(), heap_tuple_fetch_attr(), heap_tuple_from_minimal_tuple(), heap_tuple_untoast_attr(), heap_tuple_untoast_attr_slice(), hladdword(), hstore_akeys(), hstore_avals(), hstore_concat(), hstore_delete(), hstore_delete_array(), hstore_delete_hstore(), hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_out(), hstore_populate_record(), hstore_recv(), hstore_slice_to_array(), hstore_slice_to_hstore(), hstore_to_array_internal(), hstoreArrayToPairs(), hstorePairs(), identify_opfamily_groups(), ImportSnapshot(), index_register(), inet_gist_compress(), inet_gist_fetch(), inet_gist_picksplit(), inet_set_masklen(), inet_spg_inner_consistent(), inet_spg_picksplit(), infix(), init_execution_state(), init_slab_allocator(), init_tsvector_parser(), InitCatCache(), InitDeadLockChecking(), initGISTstate(), initialize_brin_buildstate(), initKeyArray(), InitPlan(), initRectBox(), initStringInfo(), int2out(), int2vectorout(), int44in(), int44out(), int4_to_char(), int4out(), Int64GetDatum(), int8_to_char(), int_to_roman(), interpret_function_parameter_list(), interval_div(), interval_in(), interval_justify_days(), interval_justify_hours(), interval_justify_interval(), interval_mi(), interval_mul(), interval_pl(), interval_recv(), interval_scale(), interval_trunc(), interval_um(), intervaltypmodout(), iterate_word_similarity(), iteratorFromContainer(), json_agg_transfn(), json_object_agg_transfn(), json_object_keys(), jsonb_agg_transfn(), jsonb_object_agg_transfn(), jsonb_object_keys(), JsonbDeepContains(), JsonbValueToJsonb(), lazy_scan_heap(), lazy_space_alloc(), lca(), leafRepackItems(), leftmostvalue_interval(), leftmostvalue_timetz(), lex_accept(), LexizeAddLemm(), libpqrcv_readtimelinehistoryfile(), like_fixed_prefix(), limit_printout_length(), line_construct_pm(), line_construct_pp(), line_in(), line_recv(), list_copy(), list_copy_tail(), lo_get_fragment_internal(), load_categories_hash(), load_domaintype_info(), load_enum_cache_data(), load_relcache_init_file(), load_tzoffsets(), logfile_getname(), logical_heap_rewrite_flush_mappings(), logicalrep_read_attrs(), logicalrep_read_rel(), logicalrep_rel_open(), logicalrep_relmap_update(), LogicalTapeFreeze(), LogicalTapeRewindForRead(), LogicalTapeSetCreate(), LogicalTapeWrite(), lookup_var_attr_stats(), lowerstr_with_len(), lpad(), lquery_out(), lseg_center(), lseg_construct(), lseg_in(), lseg_recv(), ltree2text(), ltree_compress(), ltree_decompress(), ltree_in(), ltree_out(), ltree_picksplit(), ltxtq_out(), macaddr8_out(), macaddr_and(), macaddr_in(), macaddr_not(), macaddr_or(), macaddr_out(), macaddr_recv(), macaddr_trunc(), make_colname_unique(), make_greater_string(), make_hba_token(), make_interval(), make_pathtarget_from_tlist(), make_positional_trgm(), make_recursive_union(), make_result(), make_row_comparison_op(), make_row_from_rec_and_jsonb(), make_setop(), make_sort_from_groupcols(), make_sort_from_sortclauses(), make_text_key(), make_tuple_from_result_row(), make_tuple_indirect(), make_unique_from_pathkeys(), make_unique_from_sortclauses(), makeaclitem(), makeArrayTypeName(), makeBufFile(), MakeConfigurationMapping(), makeitem(), makeLongStringInfo(), makeNamespaceItem(), makeObjectName(), makepoint(), MakeSharedInvalidMessagesArray(), makeStringInfo(), maketree(), map_variable_attnos_mutator(), mark_hl_fragments(), MatchNamedCall(), materializeResult(), mcelem_array_contained_selec(), mcelem_tsquery_selec(), mdunlinkfork(), MergeAttributes(), mergeruns(), minimal_tuple_from_heap_tuple(), mktinterval(), mock_scram_verifier(), moveLeafs(), MultiXactIdExpand(), mXactCacheGetById(), ndistinct_for_combination(), new_head_cell(), new_list(), new_object_addresses(), new_tail_cell(), newLexeme(), newTParserPosition(), nextRectBox(), NIAddAffix(), NISortAffixes(), nodeRead(), normal_rand(), NormalizeSubWord(), NUM_cache(), numeric(), numeric_abs(), numeric_sortsupport(), numeric_to_char(), numeric_to_number(), numeric_uminus(), numeric_uplus(), numerictypmodout(), offset_to_interval(), oidout(), oidvectorout(), oidvectortypes(), OpernameGetCandidates(), optionListToArray(), order_qual_clauses(), ordered_set_startup(), packGraph(), PageGetTempPage(), PageGetTempPageCopy(), PageGetTempPageCopySpecial(), pairingheap_allocate(), palloc_btree_page(), parse_fcall_arguments(), parse_fixed_parameters(), parse_hstore(), parse_ident_line(), parse_key_value_arrays(), parse_one_reloption(), parse_tsquery(), parse_variable_parameters(), parseRelOptions(), path_add(), path_in(), path_poly(), path_recv(), percentile_cont_multi_final_common(), percentile_disc_multi_final(), perform_base_backup(), perform_default_encoding_conversion(), PerformRadiusTransaction(), pg_armor(), pg_blocking_pids(), pg_buffercache_pages(), pg_convert(), pg_dearmor(), pg_decrypt(), pg_decrypt_iv(), pg_detoast_datum_copy(), pg_digest(), pg_do_encoding_conversion(), pg_encrypt(), pg_encrypt_iv(), pg_get_constraintdef_worker(), pg_get_multixact_members(), pg_get_publication_tables(), pg_get_userbyid(), pg_hmac(), pg_listening_channels(), pg_lock_status(), pg_logdir_ls(), pg_ls_dir(), pg_ls_dir_files(), pg_prepared_xact(), pg_random_bytes(), pg_random_uuid(), pg_tablespace_databases(), pg_timezone_abbrevs(), pg_timezone_names(), pgfnames(), pgp_armor_headers(), pgp_extract_armor_headers(), pgp_key_id_w(), pgrowlocks(), pgss_post_parse_analyze(), pgss_shmem_startup(), placeChar(), plaintree(), plperl_build_tuple_result(), plperl_ref_from_pg_array(), plperl_spi_exec_prepared(), plperl_spi_prepare(), plperl_spi_query_prepared(), plperl_to_hstore(), plpgsql_add_initdatums(), plpgsql_estate_setup(), plpgsql_exec_trigger(), plpgsql_finish_datums(), plpgsql_ns_additem(), plpgsql_parse_dblword(), plpgsql_parse_err_condition(), plpgsql_parse_tripword(), plpython_to_hstore(), pltcl_quote(), pltcl_SPI_execute_plan(), pltcl_SPI_prepare(), PLy_cursor_plan(), PLy_procedure_munge_source(), PLy_spi_execute_plan(), PLy_spi_prepare(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLyObject_ToBytea(), PLySequence_ToArray(), PLySequence_ToComposite(), pmx(), pnstrdup(), point_add(), point_box(), point_construct(), point_copy(), point_div(), point_in(), point_mul(), point_recv(), point_sub(), policy_role_list_to_array(), poly2path(), poly_circle(), poly_path(), populate_record_worker(), populate_recordset_object_end(), populate_recordset_object_field_end(), PostgresMain(), postquel_sub_params(), pq_getmsgtext(), prepare_sort_from_pathkeys(), prepare_sql_fn_parse_info(), PrepareQuery(), preprocess_grouping_sets(), PrescanPreparedTransactions(), ProcArrayApplyRecoveryInfo(), process_pipe_input(), process_startup_options(), process_syncing_tables_for_apply(), prs_setup_firstcall(), prsd_lextype(), psprintf(), publicationListToArray(), pull_up_sublinks_jointree_recurse(), pushJsonbValueScalar(), PushOverrideSearchPath(), pushquery(), pushStackIfSplited(), pushState(), pushval_morph(), QTNCopy(), queryin(), queue_listen(), quote_identifier(), quote_literal(), quote_literal_cstr(), range_gist_double_sorting_split(), range_gist_picksplit(), range_gist_single_sorting_split(), rb_create(), RE_compile(), RE_compile_and_cache(), RE_execute(), read_binary_file(), read_client_final_message(), read_dictionary(), read_extension_aux_control_file(), read_tablespace_map(), read_whole_file(), readAttrNumberCols(), readBoolCols(), readDatum(), readIntCols(), readOidCols(), readstoplist(), readTimeLineHistory(), readtup_heap(), ReadTwoPhaseFile(), rebuild_database_list(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_in(), record_out(), record_recv(), record_send(), reduce_outer_joins_pass1(), regclassout(), regconfigout(), regdictionaryout(), regexp_fixed_prefix(), regexp_match(), regexp_matches(), register_label_provider(), register_on_commit_action(), RegisterDynamicBackgroundWorker(), regnamespaceout(), regoperout(), regprocout(), regroleout(), regtypeout(), RelationBuildPartitionDesc(), RelationBuildTriggers(), RelationGetExclusionInfo(), RelationGetIndexScan(), RelationGetPartitionDispatchInfo(), reltime_interval(), RememberFsyncRequest(), RememberToFreeTupleDescAtEOX(), RemoveRoleFromObjectPolicy(), ReorderBufferQueueMessage(), reorderqueue_push(), repeat(), replace_auto_config_value(), replace_text_regexp(), report_invalid_token(), report_json_context(), report_parse_error(), ResolveRecoveryConflictWithVirtualXIDs(), RestoreParamList(), RewriteQuery(), rpad(), save_state_data(), scanPendingInsert(), scanstr(), scram_build_verifier(), scram_verify_plain_password(), SearchCatCacheList(), searchRangeTableForCol(), seg_in(), seg_inter(), seg_out(), seg_union(), select_outer_pathkeys_for_merge(), selectColorTrigrams(), sepgsql_fmgr_hook(), seq_redo(), SerializeTransactionState(), set_plan_references(), set_relation_column_names(), set_rtable_names(), set_var_from_str(), setup_firstcall(), setup_pct_info(), setup_regexp_matches(), shm_mq_attach(), show_trgm(), SignalBackends(), similar_escape(), slot_fill_defaults(), smgrDoPendingDeletes(), smgrdounlinkall(), smgrGetPendingDeletes(), SnapBuildInitialSnapshot(), sort_policies_by_name(), SortAndUniqItems(), spg_box_quad_inner_consistent(), spg_box_quad_picksplit(), spg_kd_inner_consistent(), spg_kd_picksplit(), spg_quad_inner_consistent(), spg_quad_picksplit(), spg_range_quad_inner_consistent(), spg_range_quad_picksplit(), spg_text_choose(), spg_text_inner_consistent(), spg_text_leaf_consistent(), spg_text_picksplit(), spgAddPendingTID(), spgbeginscan(), spgbuildempty(), spgExtractNodeLabels(), spgRedoVacuumRedirect(), spgSplitNodeAction(), spgWalk(), spi_dest_startup(), SPI_modifytuple(), SplitToVariants(), ssl_extension_info(), StandbyAcquireAccessExclusiveLock(), StartPrepare(), startScanKey(), StartupXLOG(), statext_ndistinct_build(), statext_ndistinct_serialize(), std_typanalyze(), store_flush_position(), StoreRelCheck(), storeRow(), str_initcap(), str_tolower(), str_toupper(), string_to_bytea_const(), strlist_to_textarray(), SyncRepGetNthLatestSyncRecPtr(), SyncRepWaitForLSN(), systable_beginscan(), systable_beginscan_ordered(), table_recheck_autovac(), tablesample_init(), tbm_begin_iterate(), testprs_lextype(), text_catenate(), text_position_setup(), text_reverse(), text_substring(), text_to_bits(), text_to_cstring(), thesaurus_lexize(), tidin(), TidListEval(), tidrecv(), time_interval(), time_mi_time(), time_timetz(), timestamp_age(), timestamp_mi(), timestamptz_age(), timestamptz_timetz(), timetravel(), timetz_in(), timetz_izone(), timetz_mi_interval(), timetz_pl_interval(), timetz_recv(), timetz_scale(), timetz_zone(), tintervalin(), tintervalout(), tintervalrecv(), to_tsvector_byid(), toast_compress_datum(), toast_decompress_datum(), toast_fetch_datum(), toast_fetch_datum_slice(), toast_open_indexes(), toast_save_datum(), tokenize_file(), tokenize_inc_file(), TParserInit(), TQExamineRecord(), TQRemapTuple(), transformRangeTableFunc(), transformRelOptions(), translate(), ts_dist(), ts_headline_byid_opt(), ts_lexize(), TS_phrase_output(), ts_process_call(), tsqueryout(), tsqueryrecv(), tsquerytree(), tstz_dist(), tsvector_setweight(), tsvector_setweight_by_filter(), tsvector_to_array(), tsvector_unnest(), tsvector_update_trigger(), tsvectorin(), tsvectorout(), tt_setup_firstcall(), ttdummy(), tuple_data_split_internal(), TupleDescGetAttInMetadata(), TupleQueueHandleControlMessage(), tuplesort_begin_common(), tuplestore_begin_common(), txid_current_snapshot(), txid_snapshot_recv(), typenameTypeMod(), uniqueWORD(), update_attstats(), UpdateLogicalMappings(), uuid_in(), uuid_recv(), uuid_sortsupport(), vac_open_indexes(), validate_pkattnums(), varbit(), varbit_out(), varbit_recv(), variable_paramref_hook(), varstr_abbrev_convert(), varstr_cmp(), varstr_levenshtein(), varstr_sortsupport(), vm_extend(), WaitOnLock(), widget_in(), writeListPage(), xidout(), XLogFileNameP(), XlogReadTwoPhaseData(), xml_recv(), xpath_string(), xpath_table(), and xslt_process().

850 {
851  /* duplicates MemoryContextAlloc to avoid increased overhead */
852  void *ret;
853 
856 
857  if (!AllocSizeIsValid(size))
858  elog(ERROR, "invalid memory alloc request size %zu", size);
859 
860  CurrentMemoryContext->isReset = false;
861 
863  if (ret == NULL)
864  {
866  ereport(ERROR,
867  (errcode(ERRCODE_OUT_OF_MEMORY),
868  errmsg("out of memory"),
869  errdetail("Failed on request of size %zu.", size)));
870  }
871 
873 
874  return ret;
875 }
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void* palloc0 ( Size  size)

Definition at line 878 of file mcxt.c.

References MemoryContextMethods::alloc, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MCXT_ALLOC_ZERO, MemoryContextIsValid, MemoryContextStats(), MemSetAligned, MemoryContextData::methods, NULL, pg_malloc_internal(), and VALGRIND_MEMPOOL_ALLOC.

Referenced by _bt_blwritepage(), _bt_load(), _bt_pagestate(), _bt_preprocess_array_keys(), _bt_spoolinit(), _h_spoolinit(), _ltq_extract_regex(), _ltree_compress(), _ltree_extract_isparent(), _ltree_extract_risparent(), _ltree_picksplit(), _ltree_union(), _ltxtq_extract_exec(), _mdfd_getseg(), accum_sum_rescale(), add_column_to_pathtarget(), add_dummy_return(), allocacl(), AllocateRelationDesc(), allocateReloptStruct(), AllocateSnapshotBuilder(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOpFamilyAdd(), AlterOpFamilyDrop(), array_cat(), array_create_iterator(), array_get_slice(), array_in(), array_map(), array_recv(), array_replace_internal(), array_set_element(), array_set_slice(), array_to_tsvector(), ATAddCheckConstraint(), ATAddForeignKeyConstraint(), ATExecAddColumn(), ATGetQueueEntry(), ATPrepAlterColumnType(), begin_heap_rewrite(), BeginCopy(), bernoulli_initsamplescan(), BipartiteMatch(), bit(), bit_in(), blbulkdelete(), blgetbitmap(), BloomFormTuple(), blvacuumcleanup(), bms_make_singleton(), bpchar_name(), brin_form_placeholder_tuple(), brin_form_tuple(), brin_inclusion_opcinfo(), brin_minmax_opcinfo(), brin_new_memtuple(), brinbulkdelete(), bringetbitmap(), brinvacuumcleanup(), bt_page_items(), btbulkdelete(), btvacuumcleanup(), build_inet_union_key(), build_pertrans_for_aggref(), build_row_from_class(), build_row_from_vars(), build_simple_rel(), BuildDescForRelation(), BuildEventTriggerCache(), buildint2vector(), buildoidvector(), calc_rank_and(), calc_rank_cd(), calc_word_similarity(), check_hba(), check_ident_usermap(), chkpass_in(), cidr_set_masklen_internal(), circle_poly(), collect_corrupt_items(), collect_visibility_data(), compact_palloc0(), CompactCheckpointerRequestQueue(), compile_plperl_function(), compile_pltcl_function(), construct_empty_array(), construct_md_array(), convert_tuples_by_name_map(), convert_tuples_by_position(), ConvertTriggerToFK(), copy_ltree(), CopyCachedPlan(), create_array_envelope(), create_groupingsets_plan(), CreateCachedPlan(), CreateFakeRelcacheEntry(), CreateIntoRelDestReceiver(), CreateOneShotCachedPlan(), CreateParallelContext(), CreateSQLFunctionDestReceiver(), CreateTransientRelDestReceiver(), CreateTupleDescCopyConstr(), CreateTupleQueueDestReceiver(), CreateTupleQueueReader(), CreateTuplestoreDestReceiver(), crosstab(), cube_a_f8(), cube_a_f8_f8(), cube_c_f8(), cube_c_f8_f8(), cube_enlarge(), cube_f8(), cube_f8_f8(), cube_inter(), cube_subset(), cube_union_v0(), deconstruct_array(), DefineOpClass(), deparse_context_for(), deparse_context_for_plan_rtable(), dintdict_init(), dintdict_lexize(), disassembleLeaf(), dispell_init(), div_var(), div_var_fast(), do_analyze_rel(), doPickSplit(), dsimple_init(), dsimple_lexize(), dsm_impl_mmap(), dsnowball_init(), dsnowball_lexize(), dsynonym_init(), dsynonym_lexize(), dxsyn_init(), each_worker(), elements_worker(), eqjoinsel_inner(), eqjoinsel_semi(), EvalPlanQualStart(), EventTriggerCollectAlterDefPrivs(), EventTriggerCollectAlterTSConfig(), EventTriggerCollectCreateOpClass(), EventTriggerSQLDropAddObject(), examine_attribute(), ExecBuildAuxRowMark(), ExecGrant_Relation(), ExecHashIncreaseNumBatches(), ExecHashTableCreate(), ExecHashTableReset(), ExecIndexBuildScanKeys(), ExecInitAgg(), ExecInitAppend(), ExecInitArrayRef(), ExecInitBitmapAnd(), ExecInitBitmapOr(), ExecInitExprRec(), ExecInitFunc(), ExecInitGatherMerge(), ExecInitIndexScan(), ExecInitJunkFilterConversion(), ExecInitLockRows(), ExecInitMergeAppend(), ExecInitModifyTable(), ExecInitParallelPlan(), ExecInitSetOp(), ExecInitWindowAgg(), ExecSetupPartitionTupleRouting(), expand_colnames_array_to(), extract_rollup_sets(), fetch_more_data(), fetch_remote_table_info(), fetch_statentries_for_relation(), fillFakeState(), find_language_template(), find_window_functions(), findeq(), formrdesc(), g_intbig_compress(), gather_merge_init(), gbt_macad8_union(), gbt_macad_union(), gbt_num_bin_union(), gbt_num_compress(), gbt_var_key_copy(), gbt_var_node_truncate(), generate_base_implied_equalities_no_const(), generate_combinations(), get_json_object_as_hash(), get_relation_info(), get_worker(), GetAccessStrategy(), getColorInfo(), GetLockConflicts(), GetOverrideSearchPath(), GetRelationPublicationActions(), ghstore_compress(), gin_extract_tsquery(), ginbulkdelete(), ginExtractEntries(), ginFillScanKey(), ginNewScanKey(), ginScanToDelete(), ginvacuumcleanup(), gist_box_picksplit(), gistbeginscan(), gistbulkdelete(), gistdoinsert(), gistFindPath(), gistUserPicksplit(), gistvacuumcleanup(), hashbulkdelete(), heap_form_minimal_tuple(), identify_join_columns(), index_form_tuple(), inet_gist_compress(), inet_gist_fetch(), inetand(), inetnot(), inetor(), inheritance_planner(), init_sql_fcache(), InitCatCache(), initHyperLogLog(), InitializeParallelDSM(), InitResultRelInfo(), initSpGistState(), inittapes(), inline_function(), inner_subltree(), InstrAlloc(), int2vectorin(), internal_inetpl(), interpret_function_parameter_list(), join_tsqueries(), json_array_length(), json_object_keys(), json_strip_nulls(), jsonb_agg_transfn(), jsonb_object_agg_transfn(), lazy_scan_heap(), lazy_vacuum_rel(), lca_inner(), leftmostvalue_macaddr(), leftmostvalue_macaddr8(), libpqrcv_connect(), libpqrcv_exec(), load_relcache_init_file(), lquery_in(), ltree_compress(), ltree_concat(), ltree_in(), ltree_picksplit(), ltree_union(), macaddr8_and(), macaddr8_in(), macaddr8_not(), macaddr8_or(), macaddr8_recv(), macaddr8_set7bit(), macaddr8_trunc(), macaddr8tomacaddr(), macaddrtomacaddr8(), make_one_range_bound(), make_parsestate(), make_sort_input_target(), make_tsvector(), make_tuple_from_result_row(), make_tuple_indirect(), makeArrayResultArr(), makeDefaultBloomOptions(), makeJsonLexContextCstringLen(), makeNumericAggState(), makeNumericAggStateCurrentContext(), MergeAttributes(), MJExamineQuals(), mkVoidAffix(), mul_var(), multi_sort_init(), namein(), namerecv(), ndistinct_for_combination(), network_broadcast(), network_hostmask(), network_in(), network_netmask(), network_network(), network_recv(), new_intArrayType(), NewExplainState(), newRegisNode(), NIImportOOAffixes(), NISortDictionary(), oidvectorin(), ordered_set_startup(), parse_hba_line(), parse_ident_line(), parse_tsquery(), perform_base_backup(), pg_be_scram_init(), pg_crypt(), pg_decode_startup(), pg_logical_slot_get_changes_guts(), pg_stat_get_wal_receiver(), pg_tzenumerate_start(), pgoutput_startup(), placeChar(), plperl_build_tuple_result(), plperl_modify_tuple(), plperl_ref_from_pg_array(), plperl_spi_prepare(), plpgsql_build_record(), plpgsql_build_variable(), plpgsql_compile_inline(), plpgsql_estate_setup(), pltcl_build_tuple_result(), pltcl_SPI_prepare(), PLy_input_datum_func2(), PLy_input_tuple_funcs(), PLy_modify_tuple(), PLy_output_datum_func2(), PLy_output_tuple_funcs(), PLy_procedure_create(), poly_in(), poly_recv(), populate_recordset_worker(), postgresBeginDirectModify(), postgresBeginForeignModify(), postgresBeginForeignScan(), postgresGetForeignJoinPaths(), postgresGetForeignRelSize(), postgresGetForeignUpperPaths(), prepare_query_params(), prepare_sql_fn_parse_info(), preprocess_grouping_sets(), printtup_create_DR(), printtup_prepare_info(), ProcessCopyOptions(), ProcessStartupPacket(), pull_up_simple_subquery(), pull_up_simple_values(), pushOperator(), pushStop(), pushValue_internal(), QT2QTN(), QTN2QT(), QTNBinary(), queryin(), range_serialize(), read_extension_control_file(), refresh_by_match_merge(), RelationBuildLocalRelation(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildRowSecurity(), RelationBuildTriggers(), remap_groupColIdx(), remove_useless_groupby_columns(), ReorderBufferToastReplace(), resetSpGistScanOpaque(), reverse_name(), rewriteTargetListIU(), save_state_data(), sepgsql_avc_compute(), sepgsql_set_client_label(), set_append_rel_size(), set_deparse_for_query(), set_join_column_names(), set_simple_column_names(), set_subquery_pathlist(), setup_regexp_matches(), setup_simple_rel_arrays(), spg_quad_picksplit(), spgbeginscan(), spgbuild(), spgbulkdelete(), spgFormInnerTuple(), spgFormLeafTuple(), spgFormNodeTuple(), spgvacuumcleanup(), spi_dest_startup(), standard_ExecutorStart(), standard_join_search(), StartPrepare(), StartupDecodingContext(), statext_ndistinct_deserialize(), system_initsamplescan(), system_rows_initsamplescan(), system_time_initsamplescan(), tbm_attach_shared_iterate(), test_rls_hooks_permissive(), test_rls_hooks_restrictive(), testprs_start(), text_name(), thesaurus_init(), TidExprListCreate(), toast_flatten_tuple_to_datum(), toast_insert_or_update(), TParserCopyInit(), TParserInit(), transformTableLikeClause(), transformValuesClause(), transformWithClause(), trgm_presence_map(), ts_setup_firstcall(), tsquery_not(), tsqueryrecv(), tsvector_concat(), tsvector_delete_arr(), tsvector_delete_by_indices(), tsvector_filter(), tsvector_strip(), tsvectorin(), tsvectorrecv(), TupleDescGetAttInMetadata(), tuplesort_begin_cluster(), tuplesort_begin_common(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_begin_index_btree(), tuplestore_begin_common(), unaccent_lexize(), varbit_in(), and XmlTableInitOpaque().

879 {
880  /* duplicates MemoryContextAllocZero to avoid increased overhead */
881  void *ret;
882 
885 
886  if (!AllocSizeIsValid(size))
887  elog(ERROR, "invalid memory alloc request size %zu", size);
888 
889  CurrentMemoryContext->isReset = false;
890 
892  if (ret == NULL)
893  {
895  ereport(ERROR,
896  (errcode(ERRCODE_OUT_OF_MEMORY),
897  errmsg("out of memory"),
898  errdetail("Failed on request of size %zu.", size)));
899  }
900 
902 
903  MemSetAligned(ret, 0, size);
904 
905  return ret;
906 }
#define MemSetAligned(start, val, len)
Definition: c.h:890
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
void* palloc_extended ( Size  size,
int  flags 
)

Definition at line 909 of file mcxt.c.

References MemoryContextMethods::alloc, AllocHugeSizeIsValid, AllocSizeIsValid, AssertArg, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, MemoryContextData::isReset, MCXT_ALLOC_HUGE, MCXT_ALLOC_NO_OOM, MCXT_ALLOC_ZERO, MemoryContextIsValid, MemoryContextStats(), MemSetAligned, MemoryContextData::methods, NULL, pg_malloc_internal(), and VALGRIND_MEMPOOL_ALLOC.

Referenced by allocate_recordbuf(), and XLogReaderAllocate().

910 {
911  /* duplicates MemoryContextAllocExtended to avoid increased overhead */
912  void *ret;
913 
916 
917  if (((flags & MCXT_ALLOC_HUGE) != 0 && !AllocHugeSizeIsValid(size)) ||
918  ((flags & MCXT_ALLOC_HUGE) == 0 && !AllocSizeIsValid(size)))
919  elog(ERROR, "invalid memory alloc request size %zu", size);
920 
921  CurrentMemoryContext->isReset = false;
922 
924  if (ret == NULL)
925  {
926  if ((flags & MCXT_ALLOC_NO_OOM) == 0)
927  {
929  ereport(ERROR,
930  (errcode(ERRCODE_OUT_OF_MEMORY),
931  errmsg("out of memory"),
932  errdetail("Failed on request of size %zu.", size)));
933  }
934  return NULL;
935  }
936 
938 
939  if ((flags & MCXT_ALLOC_ZERO) != 0)
940  MemSetAligned(ret, 0, size);
941 
942  return ret;
943 }
#define MemSetAligned(start, val, len)
Definition: c.h:890
#define MCXT_ALLOC_HUGE
Definition: fe_memutils.h:16
MemoryContextMethods * methods
Definition: memnodes.h:79
#define MCXT_ALLOC_NO_OOM
Definition: fe_memutils.h:18
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
void *(* alloc)(MemoryContext context, Size size)
Definition: memnodes.h:56
int errdetail(const char *fmt,...)
Definition: elog.c:873
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
#define ereport(elevel, rest)
Definition: elog.h:122
#define AssertArg(condition)
Definition: c.h:677
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
#define MemoryContextIsValid(context)
Definition: memnodes.h:97
#define NULL
Definition: c.h:229
#define VALGRIND_MEMPOOL_ALLOC(context, addr, size)
Definition: memdebug.h:29
#define MCXT_ALLOC_ZERO
Definition: fe_memutils.h:19
#define AllocHugeSizeIsValid(size)
Definition: memutils.h:46
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
char* pchomp ( const char *  in)

Definition at line 1101 of file mcxt.c.

References pnstrdup().

Referenced by connect_pg_server(), dblink_connect(), dblink_error_message(), dblink_get_conn(), dblink_res_error(), dblink_send_query(), libpqrcv_connect(), libpqrcv_create_slot(), libpqrcv_endstreaming(), libpqrcv_exec(), libpqrcv_identify_system(), libpqrcv_readtimelinehistoryfile(), libpqrcv_receive(), libpqrcv_send(), libpqrcv_startstreaming(), pg_attribute_noreturn(), pgfdw_report_error(), and storeQueryResult().

1102 {
1103  size_t n;
1104 
1105  n = strlen(in);
1106  while (n > 0 && in[n - 1] == '\n')
1107  n--;
1108  return pnstrdup(in, n);
1109 }
char * pnstrdup(const char *in, Size len)
Definition: mcxt.c:1088
void pfree ( void *  pointer)

Definition at line 950 of file mcxt.c.

References MemoryContextMethods::free_p, GetMemoryChunkContext(), MemoryContextData::methods, pg_free(), and VALGRIND_MEMPOOL_FREE.

Referenced by _bt_blwritepage(), _bt_buildadd(), _bt_freeskey(), _bt_freestack(), _bt_getroot(), _bt_gettrueroot(), _bt_insert_parent(), _bt_load(), _bt_newroot(), _bt_spooldestroy(), _bt_uppershutdown(), _fdvec_resize(), _h_spooldestroy(), _hash_splitbucket(), _hash_squeezebucket(), _int_contains(), _int_inter(), _int_overlap(), _int_same(), _int_union(), _lca(), _mdfd_getseg(), _mdfd_openseg(), _mdfd_segpath(), AbortBufferIO(), AbsorbFsyncRequests(), accum_sum_rescale(), accumArrayResultArr(), aclmerge(), add_partial_path(), add_path(), addArcs(), AddEnumLabel(), addHLParsedLex(), addItemPointersToLeafTuple(), addKey(), advance_combine_function(), advance_transition_function(), advance_windowaggregate(), advance_windowaggregate_base(), AfterTriggerEndSubXact(), afterTriggerFreeEventList(), afterTriggerRestoreEventList(), allocate_recordbuf(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), amvalidate(), ApplyWorkerMain(), array_free_iterator(), array_in(), array_map(), array_out(), array_recv(), array_replace_internal(), array_send(), array_set_element_expanded(), array_to_json_internal(), array_to_jsonb_internal(), array_to_text_internal(), arrayconst_cleanup_fn(), arrayexpr_cleanup_fn(), ArrayGetIntegerTypmods(), ASN1_STRING_to_text(), assign_simple_var(), AssignTransactionId(), AtEOSubXact_Inval(), AtEOSubXact_Namespace(), AtEOSubXact_on_commit_actions(), AtEOSubXact_PgStat(), AtEOXact_GUC(), AtEOXact_Namespace(), AtEOXact_on_commit_actions(), AtEOXact_RelationCache(), ATPrepAlterColumnType(), AtSubAbort_childXids(), AtSubAbort_Snapshot(), AtSubCommit_childXids(), AttrDefaultFetch(), attribute_reloptions(), autoinc(), AuxiliaryProcessMain(), backend_read_statsfile(), be_tls_close(), be_tls_open_server(), big5_to_euc_tw(), binaryheap_free(), BipartiteMatchFree(), blendscan(), blgetbitmap(), blrescan(), bms_add_members(), bms_free(), bms_int_members(), bms_join(), boolop(), BootStrapXLOG(), bpcharfastcmp_c(), bpcharrecv(), bqarr_in(), brin_build_desc(), brin_deform_tuple(), brin_form_tuple(), brin_free_tuple(), brin_inclusion_add_value(), brin_inclusion_union(), brin_minmax_add_value(), brin_minmax_union(), brin_page_items(), brinendscan(), brinoptions(), brinRevmapTerminate(), brinsummarize(), bt_downlink_check(), bt_page_items(), bt_right_page_check_scankey(), btendscan(), btinsert(), buf_finalize(), BufferSync(), BufFileClose(), build_dummy_tuple(), build_index_paths(), BuildFieldRemapInfo(), buildFreshLeafTuple(), BuildTupleFromCStrings(), cache_locale_time(), cache_single_time(), calc_arraycontsel(), calc_distr(), calc_rank_and(), calc_rank_cd(), calc_rank_or(), calc_word_similarity(), cancel_on_dsm_detach(), CatalogCloseIndexes(), CatCacheRemoveCList(), CatCacheRemoveCTup(), check_circularity(), check_datestyle(), check_db_file_conflict(), check_ident_usermap(), check_locale(), check_log_destination(), check_relation_privileges(), check_schema_perms(), check_search_path(), check_temp_tablespaces(), check_timezone(), check_TSCurrentConfig(), check_wal_consistency_checking(), CheckAffix(), CheckConstraintFetch(), CheckMD5Auth(), CheckPasswordAuth(), CheckPointTwoPhase(), CheckPWChallengeAuth(), CheckSCRAMAuth(), checkSharedDependencies(), ChooseConstraintName(), ChooseRelationName(), citext_eq(), citext_hash(), citext_ne(), citextcmp(), clauselist_selectivity(), clean_NOT_intree(), clean_stopword_intree(), cleanup_regexp_matches(), clear_and_pfree(), close_tsvector_parser(), collectMatchBitmap(), commit_ts_desc(), commit_ts_redo(), CompactCheckpointerRequestQueue(), compareJsonbContainers(), compile_plperl_function(), compile_pltcl_function(), compileTheLexeme(), compileTheSubstitute(), compute_array_stats(), concat_internal(), connect_pg_server(), construct_empty_expanded_array(), ConstructTupleDescriptor(), convert_any_priv_string(), convert_charset(), convert_column_name(), convert_string_datum(), convert_to_scalar(), convert_tuples_by_name(), convert_tuples_by_position(), convertPgWchar(), ConvertTriggerToFK(), copy_dest_destroy(), copy_file(), copy_heap_data(), copy_relation_data(), copy_table(), CopyArrayEls(), CopyFrom(), CopyFromErrorCallback(), CopyReadLine(), CopyTo(), count_usable_fds(), create_cursor(), create_script_for_old_cluster_deletion(), create_tablespace_directories(), CreateCheckPoint(), createdb(), createNewConnection(), createPostingTree(), CreateTableSpace(), CreateTrigger(), croak_cstr(), crosstab(), cstr2sv(), datasegpath(), datetime_to_char_body(), datum_to_json(), datum_to_jsonb(), db_encoding_convert(), dblink_connect(), dblink_disconnect(), dblink_security_check(), DCH_to_char(), DecodeTextArrayToCString(), DecodeXLogRecord(), default_reloptions(), DefineEnum(), DefineIndex(), DefineRange(), DefineType(), deparseConst(), deserialize_deflist(), destroy_tablespace_directories(), DestroyParallelContext(), DestroyTupleQueueReader(), dintdict_lexize(), dir_realloc(), dispell_lexize(), div_var(), div_var_fast(), do_analyze_rel(), do_autovacuum(), do_compile(), Do_MultiXactIdWait(), do_pg_start_backup(), do_text_output_multiline(), do_to_timestamp(), DoesMultiXactIdConflict(), dofindsubquery(), dotrim(), DropRelFileNodesAllBuffers(), DropSubscription(), dsa_detach(), dsimple_lexize(), dsm_create(), dsm_detach(), dsm_impl_sysv(), dsnowball_lexize(), dsynonym_init(), dsynonym_lexize(), dxsyn_lexize(), elog_node_display(), end_tup_output(), EndCopy(), entry_dealloc(), entryLoadMoreItems(), enum_range_internal(), enum_recv(), EnumValuesCreate(), eqjoinsel_inner(), eqjoinsel_semi(), errdetail_params(), errfinish(), euc_tw_to_big5(), eval_windowaggregates(), EventTriggerAlterTableEnd(), EventTriggerSQLDropAddObject(), examine_attribute(), exec_bind_message(), exec_object_restorecon(), exec_stmt_foreach_a(), Exec_UnlistenCommit(), ExecDropSingleTupleTableSlot(), ExecEndWindowAgg(), ExecEvalXmlExpr(), ExecGrant_Attribute(), ExecGrant_Database(), ExecGrant_Fdw(), ExecGrant_ForeignServer(), ExecGrant_Function(), ExecGrant_Language(), ExecGrant_Largeobject(), ExecGrant_Namespace(), ExecGrant_Relation(), ExecGrant_Tablespace(), ExecGrant_Type(), ExecHashIncreaseNumBatches(), ExecHashRemoveNextSkewBucket(), ExecHashTableDestroy(), ExecIndexBuildScanKeys(), ExecParallelCleanup(), ExecReScanTidScan(), ExecResetTupleTable(), ExecSetParamPlan(), ExecSetSlotDescriptor(), ExecShutdownGatherMergeWorkers(), ExecShutdownGatherWorkers(), expand_dynamic_library_name(), expand_grouping_sets(), explain_ExecutorEnd(), ExplainProperty(), ExplainPropertyList(), ExplainQuery(), extract_autovac_opts(), extract_rollup_sets(), fetch_finfo_record(), fetch_function_defaults(), fetch_remote_table_info(), fetch_table_list(), file_acquire_sample_rows(), filter_list_to_array(), find_in_dynamic_libpath(), find_inheritance_children(), find_provider(), findeq(), findJsonbValueFromContainer(), FinishPreparedTransaction(), fixup_inherited_columns(), flatten_reloptions(), flush_pipe_input(), fmgr_info_C_lang(), fmgr_info_cxt_security(), forget_invalid_pages(), forget_invalid_pages_db(), form_and_insert_tuple(), free_attstatsslot(), free_chromo(), free_city_table(), free_conversion_map(), free_edge_table(), free_object_addresses(), free_openssl_cipher(), free_openssl_digest(), free_parsestate(), free_pool(), free_sort_tuple(), FreeAccessStrategy(), freeAndGetParent(), FreeBulkInsertState(), FreeErrorData(), FreeExprContext(), FreeFakeRelcacheEntry(), freeGinBtreeStack(), freeHyperLogLog(), FreeQueryDesc(), freeScanStackEntry(), FreeSnapshot(), FreeSubscription(), freetree(), FreeTriggerDesc(), FreeTupleDesc(), FreeWaitEventSet(), FreezeMultiXactId(), fsm_extend(), func_get_detail(), FuncnameGetCandidates(), g_int_compress(), g_int_consistent(), g_int_decompress(), g_int_penalty(), g_int_picksplit(), g_intbig_compress(), g_intbig_picksplit(), gather_merge_clear_slots(), gbt_bit_l2n(), generate_append_tlist(), generate_base_implied_equalities_no_const(), generate_combinations(), generate_trgm_only(), generate_wildcard_trgm(), generateHeadline(), generator_free(), GenericXLogAbort(), GenericXLogFinish(), get_attstatsslot(), get_const_expr(), get_control_dbstate(), get_docrep(), get_extension_aux_control_filename(), get_extension_script_filename(), get_flush_position(), get_from_clause(), get_role_password(), get_sql_insert(), get_sql_update(), get_str_from_var_sci(), get_target_list(), get_tuple_of_interest(), get_typdefault(), GetAggInitVal(), getColorInfo(), GetMultiXactIdHintBits(), GetNewRelFileNode(), getNextNearest(), getObjectDescription(), getObjectIdentityParts(), GetRelationPublicationActions(), GetTempNamespaceBackendId(), gin_extract_jsonb_path(), gin_leafpage_items(), gin_trgm_triconsistent(), ginCompressPostingList(), ginendscan(), ginEntryFillRoot(), ginEntryInsert(), ginExtractEntries(), ginFinishSplit(), GinFormTuple(), ginFreeScanKeys(), ginoptions(), ginPostingListDecodeAllSegmentsToTbm(), ginVacuumEntryPage(), ginVacuumPostingTreeLeaf(), ginVacuumPostingTreeLeaves(), gist_ischild(), gistbulkdelete(), gistgetbitmap(), gistgettuple(), gistoptions(), gistPopItupFromNodeBuffer(), gistRelocateBuildBuffersOnSplit(), gistrescan(), gistunionsubkeyvec(), gistUnloadNodeBuffer(), gtrgm_consistent(), gtrgm_distance(), gtrgm_penalty(), GUCArrayReset(), HandleParallelMessage(), HandleParallelMessages(), hash_page_items(), hashbuildCallback(), hashendscan(), hashinsert(), heap_create_with_catalog(), heap_endscan(), heap_free_minimal_tuple(), heap_freetuple(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_modify_tuple(), heap_modify_tuple_by_cols(), heap_tuple_needs_freeze(), heap_tuple_untoast_attr(), heap_tuple_untoast_attr_slice(), hstoreUniquePairs(), hv_fetch_string(), hv_store_string(), index_form_tuple(), IndexScanEnd(), IndexSupportsBackwardScan(), infix(), initcap(), initialize_reloptions(), InitIndexAmRoutine(), initTrie(), inner_int_inter(), insert_username(), InsertOneTuple(), int8_avg_deserialize(), internalerrquery(), intorel_destroy(), intset_subtract(), inv_close(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), InvalidateAttoptCacheCallback(), InvalidateTableSpaceCacheCallback(), is_scram_verifier(), isAnyTempNamespace(), isRelDataFile(), iterate_word_similarity(), json_object(), json_object_keys(), json_object_two_arg(), jsonb_object(), jsonb_object_keys(), jsonb_object_two_arg(), jsonb_send(), JsonbDeepContains(), KnownAssignedXidsDisplay(), LaunchParallelWorkers(), lazy_cleanup_index(), lazy_scan_heap(), lazy_vacuum_rel(), lca(), leafRepackItems(), libpqrcv_create_slot(), libpqrcv_disconnect(), libpqrcv_startstreaming(), like_fixed_prefix(), list_delete_cell(), list_free_private(), lo_manage(), load_enum_cache_data(), load_external_function(), load_file(), load_libraries(), load_relcache_init_file(), local_buffer_write_error_callback(), log_line_prefix(), logfile_rotate(), logical_heap_rewrite_flush_mappings(), logicalrep_relmap_free_entry(), logicalrep_typmap_free_entry(), logicalrep_write_tuple(), LogicalTapeFreeze(), LogicalTapeRewindForRead(), LogicalTapeRewindForWrite(), LogicalTapeSetClose(), LogStandbySnapshot(), lookup_ts_config_cache(), lower(), lowerstr_with_len(), lquery_in(), lseg_inside_poly(), lseg_interpt_internal(), ltree_addtext(), ltree_in(), ltree_strncasecmp(), ltree_textadd(), make_greater_string(), make_scalar_key(), make_tsvector(), make_tuple_indirect(), map_sql_value_to_xml_value(), mark_hl_fragments(), match_special_index_operator(), mcelem_array_contained_selec(), mcelem_array_selec(), mcelem_tsquery_selec(), mdcreate(), mdopen(), mdpostckpt(), mdsync(), mdunlinkfork(), MemoryContextDelete(), merge_acl_with_grant(), merge_clump(), MergeAttributes(), mergeruns(), mkANode(), moddatetime(), mode_final(), moveArrayTypeName(), mul_var(), MultiXactIdExpand(), MultiXactIdGetUpdateXid(), MultiXactIdIsRunning(), mXactCachePut(), mxid_to_string(), namerecv(), NIImportAffixes(), NIImportDictionary(), NIImportOOAffixes(), NINormalizeWord(), NormalizeSubWord(), NUM_cache(), numeric_abbrev_convert(), numeric_avg_deserialize(), numeric_deserialize(), numeric_fast_cmp(), numeric_float4(), numeric_float8(), numeric_poly_deserialize(), numeric_to_double_no_overflow(), numeric_to_number(), numericvar_to_double_no_overflow(), open_csvlogfile(), PageRestoreTempPage(), pagetable_free(), pair_encode(), pairingheap_free(), parse_and_validate_value(), parse_args(), parse_extension_control_file(), parse_fcall_arguments(), parse_hba_line(), parse_ident_line(), parse_one_reloption(), parse_scram_verifier(), parse_tsquery(), parseCommandLine(), parseNameAndArgTypes(), parseRelOptions(), parsetext(), patternsel(), pclose_check(), PerformRadiusTransaction(), pg_armor(), pg_attribute_aclmask(), pg_be_scram_init(), pg_class_aclmask(), pg_convert(), pg_crypt(), pg_database_aclmask(), pg_dearmor(), pg_encrypt(), pg_extension_update_paths(), pg_foreign_data_wrapper_aclmask(), pg_foreign_server_aclmask(), pg_get_constraintdef_worker(), pg_get_expr_worker(), pg_get_function_arg_default(), pg_get_indexdef_worker(), pg_get_multixact_members(), pg_get_partkeydef_worker(), pg_identify_object_as_address(), pg_language_aclmask(), pg_largeobject_aclmask_snapshot(), pg_namespace_aclmask(), pg_proc_aclmask(), pg_replication_origin_create(), pg_replication_origin_drop(), pg_replication_origin_oid(), pg_replication_origin_session_setup(), pg_split_opts(), pg_stat_file(), pg_stat_statements_internal(), pg_stop_backup_v2(), pg_tablespace_aclmask(), pg_tablespace_databases(), pg_type_aclmask(), pg_tzenumerate_end(), pg_tzenumerate_next(), pgfnames_cleanup(), PGLC_localeconv(), pgss_shmem_startup(), pgss_store(), pgstat_recv_inquiry(), plainnode(), plperl_build_tuple_result(), plperl_call_perl_func(), plperl_hash_from_tuple(), plperl_modify_tuple(), plperl_spi_exec_prepared(), plperl_spi_prepare(), plperl_spi_query_prepared(), plperl_sv_to_datum(), plperl_trigger_handler(), plpgsql_destroy_econtext(), plpgsql_extra_checks_check_hook(), plpgsql_subxact_cb(), pltcl_build_tuple_argument(), pltcl_func_handler(), pltcl_quote(), pltcl_set_tuple_values(), pltcl_trigger_handler(), PLy_abort_open_subtransactions(), PLy_cursor_plan(), PLy_elog(), PLy_function_drop_args(), PLy_function_restore_args(), PLy_input_tuple_funcs(), PLy_modify_tuple(), PLy_output(), PLy_output_tuple_funcs(), PLy_pop_execution_context(), PLy_procedure_compile(), PLy_procedure_create(), PLy_quote_literal(), PLy_quote_nullable(), PLy_spi_execute_plan(), PLy_subtransaction_exit(), PLy_traceback(), PLy_trigger_build_args(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLySequence_ToComposite(), PLyString_FromDatum(), PLyUnicode_Bytes(), pmx(), PopActiveSnapshot(), PopOverrideSearchPath(), PopTransaction(), PortalDrop(), postgresGetForeignJoinPaths(), PostmasterMain(), PostPrepare_smgr(), pprint(), pq_endmessage(), pq_puttextmessage(), pq_sendcountedtext(), pq_sendstring(), pq_sendtext(), prefix_quals(), PrepareTempTablespaces(), PrescanPreparedTransactions(), print(), print_expr(), print_function_arguments(), PrintBufferLeakWarning(), printtup_destroy(), printtup_prepare_info(), printtup_shutdown(), ProcArrayApplyRecoveryInfo(), process_block_change(), process_ordered_aggregate_single(), process_pipe_input(), ProcessCommittedInvalidationMessages(), ProcessGUCArray(), ProcessWalSndrMessage(), ProcSleep(), prs_process_call(), prune_element_hashtable(), psprintf(), PushTransaction(), pushval_morph(), px_find_cipher(), px_find_digest(), QTNFree(), QTNTernary(), queryin(), quote_object_name(), range_recv(), RE_compile(), RE_compile_and_cache(), RE_execute(), read_client_final_message(), read_dictionary(), readstoplist(), ReadTwoPhaseFile(), recomputeNamespacePath(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_in(), record_out(), record_recv(), record_send(), RecordTransactionAbort(), RecordTransactionCommit(), RecoverPreparedTransactions(), recursive_revoke(), recv_password_packet(), regex_fixed_prefix(), RehashCatCache(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationCacheInitializePhase3(), RelationDestroyRelation(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), RelationParseRelOptions(), RelationPreserveStorage(), RelationReloadIndexInfo(), relmap_redo(), RememberFsyncRequest(), remove_dbtablespaces(), RemoveLocalLock(), RenameTypeInternal(), ReorderBufferFreeSnap(), ReorderBufferIterTXNFinish(), ReorderBufferReturnChange(), ReorderBufferReturnTupleBuf(), ReorderBufferReturnTXN(), ReorderBufferToastReplace(), ReorderBufferToastReset(), reorderqueue_pop(), replace_auto_config_value(), replace_text(), replace_text_regexp(), report_invalid_page(), report_triggers(), reportDependentObjects(), ReportGUCOption(), reset_on_dsm_detach(), resetSpGistScanOpaque(), resolve_aggregate_transtype(), ResolveRecoveryConflictWithVirtualXIDs(), ResourceArrayEnlarge(), ResourceArrayFree(), ResourceOwnerDelete(), rewriteTargetListIU(), ri_LoadConstraintInfo(), rm_redo_error_callback(), RS_free(), scanPendingInsert(), select_outer_pathkeys_for_merge(), send_message_to_frontend(), send_message_to_server_log(), SendFunctionResult(), sepgsql_attribute_drop(), sepgsql_attribute_post_create(), sepgsql_attribute_relabel(), sepgsql_attribute_setattr(), sepgsql_avc_check_perms(), sepgsql_avc_compute(), sepgsql_avc_reclaim(), sepgsql_database_drop(), sepgsql_database_post_create(), sepgsql_database_relabel(), sepgsql_database_setattr(), sepgsql_proc_drop(), sepgsql_proc_execute(), sepgsql_proc_post_create(), sepgsql_proc_relabel(), sepgsql_proc_setattr(), sepgsql_relation_drop(), sepgsql_relation_post_create(), sepgsql_relation_relabel(), sepgsql_relation_setattr(), sepgsql_schema_drop(), sepgsql_schema_post_create(), sepgsql_schema_relabel(), sepgsql_xact_callback(), seq_redo(), serialize_deflist(), set_append_rel_size(), set_customscan_references(), set_foreignscan_references(), set_indexonlyscan_references(), set_join_references(), set_plan_refs(), set_returning_clause_references(), set_subquery_pathlist(), set_timetravel(), set_upper_references(), set_var_from_str(), SetClientEncoding(), setCorrLex(), setNewTmpRes(), setup_regexp_matches(), shared_buffer_write_error_callback(), shdepLockAndCheckObject(), shm_mq_receive(), show_trgm(), ShowAllGUCConfig(), ShowTransactionStateRec(), ShowUsage(), ShutdownExprContext(), SignalBackends(), similarity(), simplify_and_arguments(), simplify_or_arguments(), single_encode(), smgr_desc(), smgrDoPendingDeletes(), smgrdounlinkall(), SnapBuildFreeSnapshot(), SnapBuildPurgeCommittedTxn(), SnapBuildRestore(), spg_box_quad_inner_consistent(), spgClearPendingList(), spgdoinsert(), spggettuple(), spgRedoVacuumRedirect(), SPI_cursor_open(), SPI_modifytuple(), SPI_pfree(), SplitIdentifierString(), SplitToVariants(), sqlfunction_destroy(), StandbyRecoverPreparedTransactions(), StandbyReleaseAllLocks(), StandbyReleaseLocks(), StandbyReleaseOldLocks(), StandbyTransactionIdIsPrepared(), StartPrepare(), startScanEntry(), StartupXLOG(), StoreAttrDefault(), storeObjectDescription(), StorePartitionKey(), StoreRelCheck(), storeRow(), str_initcap(), str_tolower(), str_toupper(), string_to_text(), stringToQualifiedNameList(), SyncRepGetNthLatestSyncRecPtr(), SyncRepGetSyncStandbysPriority(), SyncRepWaitForLSN(), SysLogger_Start(), SysLoggerMain(), systable_endscan(), systable_endscan_ordered(), tablesample_init(), tablespace_reloptions(), TablespaceCreateDbspace(), tbm_end_iterate(), tbm_end_shared_iterate(), tbm_free(), terminate_brin_buildstate(), test_shm_mq_setup(), testprs_end(), text2ltree(), text_format(), text_format_string_conversion(), text_position_cleanup(), text_substring(), text_to_array_internal(), text_to_cstring(), text_to_cstring_buffer(), textrecv(), textToQualifiedNameList(), thesaurus_lexize(), thesaurusRead(), TidListEval(), timetravel(), tintervalout(), to_tsvector_byid(), toast_build_flattened_tuple(), toast_close_indexes(), toast_compress_datum(), toast_flatten_tuple(), toast_flatten_tuple_to_datum(), toast_insert_or_update(), tokenize_inc_file(), TParserClose(), TParserCopyClose(), TParserGet(), TQExamineRecord(), TQRemapRecord(), tqueueDestroyReceiver(), tqueueReceiveSlot(), transformRangeTableFunc(), transientrel_destroy(), ts_accum(), ts_headline_byid_opt(), ts_lexize(), ts_match_tq(), ts_match_tt(), ts_process_call(), ts_stat_sql(), tsquery_rewrite_query(), tsqueryrecv(), tsquerytree(), tstoreDestroyReceiver(), tstoreReceiveSlot_detoast(), tstoreShutdownReceiver(), tsvector_delete_arr(), tsvector_to_array(), tsvector_unnest(), tsvector_update_trigger(), tsvectorin(), tt_process_call(), ttdummy(), tuple_data_split(), tuple_data_split_internal(), tuplestore_advance(), tuplestore_clear(), tuplestore_end(), tuplestore_skiptuples(), tuplestore_trim(), typenameTypeMod(), typeStringToTypeName(), unaccent_dict(), uniqueentry(), uniqueWORD(), UnregisterExprContextCallback(), UnregisterResourceReleaseCallback(), UnregisterSubXactCallback(), UnregisterXactCallback(), updateAclDependencies(), UpdateIndexRelation(), UpdateLogicalMappings(), upper(), vac_close_indexes(), vacuum_one_database(), validate_index_heapscan(), varcharrecv(), varstr_abbrev_convert(), varstr_cmp(), varstrfastcmp_c(), varstrfastcmp_locale(), view_reloptions(), vm_extend(), WaitForParallelWorkersToExit(), WaitOnLock(), walrcv_clear_result(), WalRcvFetchTimeLineHistoryFiles(), WalReceiverMain(), write_auto_conf_file(), write_console(), write_csvlog(), writeListPage(), writetup_datum(), writetup_index(), X509_NAME_field_to_text(), X509_NAME_to_cstring(), X509_NAME_to_text(), xact_desc_abort(), xact_desc_commit(), XLogInsertRecord(), XLogReaderAllocate(), XLogReaderFree(), xml_encode_special_chars(), xml_out_internal(), xml_recv(), xml_send(), xmlconcat(), xmlpi(), xpath_bool(), xpath_list(), xpath_nodeset(), xpath_number(), xpath_string(), and xpath_table().

951 {
952  MemoryContext context = GetMemoryChunkContext(pointer);
953 
954  (*context->methods->free_p) (context, pointer);
955  VALGRIND_MEMPOOL_FREE(context, pointer);
956 }
MemoryContextMethods * methods
Definition: memnodes.h:79
void(* free_p)(MemoryContext context, void *pointer)
Definition: memnodes.h:58
#define VALGRIND_MEMPOOL_FREE(context, addr)
Definition: memdebug.h:30
static MemoryContext GetMemoryChunkContext(void *pointer)
Definition: memutils.h:107
char* pnstrdup ( const char *  in,
Size  len 
)

Definition at line 1088 of file mcxt.c.

References palloc().

Referenced by asc_initcap(), asc_tolower(), asc_toupper(), dintdict_lexize(), dsynonym_lexize(), dxsyn_lexize(), get_source_line(), hstore_to_plperl(), jsonb_put_escaped_value(), make_row_from_rec_and_jsonb(), pchomp(), populate_record_worker(), read_dictionary(), SplitToVariants(), str_initcap(), str_tolower(), str_toupper(), and t_readline().

1089 {
1090  char *out = palloc(len + 1);
1091 
1092  memcpy(out, in, len);
1093  out[len] = '\0';
1094  return out;
1095 }
void * palloc(Size size)
Definition: mcxt.c:849
char* psprintf ( const char *  fmt,
  ... 
)
char* pstrdup ( const char *  in)

Definition at line 1077 of file mcxt.c.

References MemoryContextStrdup(), and pg_strdup().

Referenced by _ShowOption(), abstimeout(), add_with_check_options(), addCompiledLexeme(), addRangeTableEntryForFunction(), addRangeTableEntryForSubquery(), addRangeTableEntryForTableFunc(), addRangeTableEntryForValues(), addToResult(), allocate_reloption(), AlterRole(), analyzeCTETargetList(), ApplyWorkerMain(), array_in(), array_out(), Async_Notify(), ATExecAddIndexConstraint(), ATPrepAddOids(), ATPrepCmd(), AuxiliaryProcessMain(), backend_read_statsfile(), BeginCopyFrom(), BeginCopyTo(), build_datatype(), build_minmax_path(), buildRelationAliases(), cache_locale_time(), CatalogCacheInitializeCache(), check_datestyle(), check_hostname(), check_ident_usermap(), check_locale(), check_log_destination(), check_search_path(), check_selective_binary_conversion(), check_temp_tablespaces(), check_timezone(), check_wal_consistency_checking(), checkInsertTargets(), ChooseIndexColumnNames(), ChooseIndexNameAddition(), compile_plperl_function(), compile_pltcl_function(), compileTheSubstitute(), connectby_text(), connectby_text_serial(), convert_string_datum(), CopyCachedPlan(), CopyErrorData(), CopyTriggerDesc(), copyTSLexeme(), CopyVar(), CreateCachedPlan(), CreateLockFile(), createNewConnection(), CreateParallelContextForExternalFunction(), CreateSchemaCommand(), CreateTableSpace(), CreateTupleDescCopyConstr(), cstring_in(), cstring_out(), date_out(), datum_to_jsonb(), defGetString(), DefineCollation(), DefineQueryRewrite(), DefineRelation(), DefineView(), DefineViewRules(), deleteConnection(), deserialize_deflist(), destroy_tablespace_directories(), determineRecursiveColTypes(), do_compile(), do_pg_start_backup(), DoCopy(), DropSubscription(), dsynonym_init(), ean13_out(), encrypt_password(), enum_out(), EventTriggerSQLDropAddObject(), exec_bind_message(), exec_execute_message(), Exec_ListenCommit(), expand_dynamic_library_name(), expand_targetlist(), ExpandRowReference(), expandRTE(), expandTupleDesc(), ExportSnapshot(), ExtractExtensionList(), fetch_remote_table_info(), fetch_table_list(), fill_hba_line(), FillPortalStore(), filter_list_to_array(), float8in_internal(), format_operator_parts(), format_procedure_parts(), format_type_internal(), generate_append_tlist(), generate_setop_tlist(), generateClonedIndexStmt(), get_am_name(), get_attname(), get_collation(), get_collation_actual_version(), get_collation_name(), get_configdata(), get_connect_string(), get_constraint_name(), get_database_list(), get_database_name(), get_db_info(), get_ext_ver_info(), get_ext_ver_list(), get_extension_name(), get_extension_script_directory(), get_file_fdw_attribute_options(), get_func_name(), get_language_name(), get_namespace_name(), get_opclass(), get_opname(), get_publication_name(), get_rel_name(), get_rolespec_name(), get_source_line(), get_sql_insert(), get_sql_update(), get_string_attr(), get_subscription_list(), get_subscription_name(), get_tablespace_name(), GetConfigOptionByNum(), getConnectionByName(), GetDatabasePath(), GetForeignDataWrapper(), GetForeignServer(), getObjectIdentityParts(), getOpFamilyIdentity(), GetPublication(), getRelationIdentity(), GetSubscription(), GetUserNameFromId(), HandleParallelMessage(), hstore_out(), ImportForeignSchema(), index_check_primary_key(), init_sql_fcache(), int8out(), internal_yylex(), interval_out(), isn_out(), lex_accept(), libpqrcv_create_slot(), libpqrcv_get_conninfo(), libpqrcv_identify_system(), libpqrcv_readtimelinehistoryfile(), limit_printout_length(), load_domaintype_info(), load_libraries(), logicalrep_read_attrs(), logicalrep_read_origin(), logicalrep_read_rel(), logicalrep_read_typ(), logicalrep_relmap_update(), logicalrep_typmap_update(), lowerstr_with_len(), makeAlias(), makeColumnDef(), map_sql_value_to_xml_value(), MapArrayTypeName(), MergeAttributes(), nameout(), network_out(), NINormalizeWord(), NormalizeSubWord(), numeric_normalize(), numeric_out(), numeric_out_sci(), object_to_string(), okeys_object_field_start(), parse_extension_control_file(), parse_hba_auth_opt(), parse_hba_line(), parse_ident_line(), parse_scram_verifier(), parseNameAndArgTypes(), ParseTzFile(), perform_base_backup(), PerformCursorOpen(), pg_available_extension_versions(), pg_available_extensions(), pg_collation_actual_version(), pg_event_trigger_ddl_commands(), pg_import_system_collations(), pg_logdir_ls(), pg_ls_dir_files(), pg_lsn_out(), pg_split_opts(), pg_stat_get_wal_receiver(), pg_tzenumerate_next(), pg_tzenumerate_start(), pgfnames(), PGLC_localeconv(), pgrowlocks(), pgstat_recv_inquiry(), pgstatindex_impl(), plperl_init_interp(), plperl_to_hstore(), plpgsql_build_record(), plpgsql_build_variable(), plpgsql_compile_inline(), plpgsql_extra_checks_check_hook(), plpgsql_parse_dblword(), plpgsql_parse_tripword(), pltcl_set_tuple_values(), PLy_output(), PLy_procedure_create(), PLyObject_AsString(), PLyUnicode_AsString(), postgresAddForeignUpdateTargets(), postgresImportForeignSchema(), PostmasterMain(), pq_parse_errornotice(), prepare_foreign_modify(), prepare_sql_fn_parse_info(), PrepareTempTablespaces(), preprocess_targetlist(), process_psqlrc(), ProcessStartupPacket(), ProcessWalSndrMessage(), prsd_headline(), prsd_lextype(), pset_value_string(), range_deparse(), read_client_final_message(), read_client_first_message(), read_dictionary(), read_extension_control_file(), read_tablespace_map(), readRecoveryCommandFile(), recomputeNamespacePath(), regclassout(), regconfigout(), regdictionaryout(), register_label_provider(), regnamespaceout(), regoperatorout(), regoperout(), regprocedureout(), regprocout(), regroleout(), regtypeout(), RelationBuildRowSecurity(), RelationBuildTriggers(), reltimeout(), RemoveInheritance(), ReorderBufferQueueMessage(), replace_auto_config_value(), ReThrowError(), rewriteTargetListIU(), rewriteTargetListUD(), rewriteTargetView(), scanstr(), sepgsql_avc_compute(), sepgsql_compute_create(), sepgsql_get_label(), sepgsql_mcstrans_in(), sepgsql_mcstrans_out(), sepgsql_set_client_label(), set_relation_column_names(), show_sort_group_keys(), smgrout(), SPI_fname(), SPI_getrelname(), SPI_gettype(), SplitDirectoriesString(), splitTzLine(), stringToQualifiedNameList(), strip_trailing_ws(), substitute_libpath_macro(), SysLoggerMain(), TablespaceCreateDbspace(), test_rls_hooks_permissive(), test_rls_hooks_restrictive(), testprs_lextype(), textarray_to_stringlist(), textToQualifiedNameList(), thesaurus_init(), throw_tcl_error(), ThrowErrorData(), tidout(), time_out(), timestamp_out(), timestamptz_out(), timetz_out(), tokenize_file(), tokenize_inc_file(), transformFkeyGetPrimaryKey(), transformIndexConstraint(), transformOfType(), transformOnConflictClause(), transformRangeTableFunc(), transformRowExpr(), transformSetOperationStmt(), transformTableLikeClause(), typeTypeName(), unicode_to_sqlchar(), unknownin(), unknownout(), untransformRelOptions(), utf_e2u(), utf_u2e(), void_out(), wait_result_to_str(), X509_NAME_to_cstring(), XmlTableGetValue(), and xpstrdup().

1078 {
1080 }
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
char * MemoryContextStrdup(MemoryContext context, const char *string)
Definition: mcxt.c:1064
char size_t pvsnprintf ( char *  buf,
size_t  len,
const char *  fmt,
va_list  args 
)
void* repalloc ( void *  pointer,
Size  size 
)

Definition at line 963 of file mcxt.c.

References AllocSizeIsValid, Assert, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, GetMemoryChunkContext(), MemoryContextData::isReset, MemoryContextStats(), MemoryContextData::methods, NULL, pg_realloc(), MemoryContextMethods::realloc, and VALGRIND_MEMPOOL_CHANGE.

Referenced by _fdvec_resize(), accumArrayResult(), accumArrayResultArr(), add_column_to_pathtarget(), add_exact_object_address(), add_exact_object_address_extra(), add_object_address(), add_reloption(), addCompiledLexeme(), addCompoundAffixFlagValue(), addDatum(), AddStem(), addToArray(), addWrd(), AfterTriggerBeginSubXact(), AfterTriggerEnlargeQueryState(), appendElement(), appendKey(), array_set_element_expanded(), assign_record_type_typmod(), AtSubCommit_childXids(), bms_add_member(), BufferSync(), checkcondition_str(), compileTheLexeme(), compileTheSubstitute(), CopyReadAttributesCSV(), CopyReadAttributesText(), count_usable_fds(), cube_inter(), dsnowball_lexize(), dsynonym_init(), dxsyn_lexize(), enum_range_internal(), ExecHashIncreaseNumBatches(), ExecHashIncreaseNumBuckets(), ExecIndexBuildScanKeys(), expand_colnames_array_to(), ExprEvalPushStep(), extendBufFile(), find_inheritance_children(), generateHeadline(), get_docrep(), GetComboCommandId(), GetLockStatusData(), GetSingleProcBlockerStatusData(), gettoken_tsvector(), gin_extract_jsonb(), gin_extract_jsonb_path(), ginFillScanEntry(), GinFormTuple(), ginHeapTupleFastCollect(), ginPostingListDecodeAllSegments(), gistAddLoadedBuffer(), gistBuffersReleaseBlock(), gistGetNodeBuffer(), gistjoinvector(), gtsvector_compress(), hladdword(), hlfinditem(), load_domaintype_info(), load_enum_cache_data(), load_relcache_init_file(), LockAcquireExtended(), ltsReleaseBlock(), LWLockRegisterTranche(), MakeSharedInvalidMessagesArray(), mark_hl_fragments(), MergeAffix(), newLexeme(), newLOfd(), NIAddAffix(), NIAddSpell(), NISortAffixes(), oidvectortypes(), okeys_object_field_start(), parse_hstore(), parsetext(), pgfnames(), pgss_shmem_startup(), plainnode(), plpgsql_adddatum(), PrescanPreparedTransactions(), prs_setup_firstcall(), pushval_asis(), pushValue(), QTNTernary(), read_dictionary(), readstoplist(), record_corrupt_item(), RecordConstLocation(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RememberToFreeTupleDescAtEOX(), ReorderBufferSerializeReserve(), RequestNamedLWLockTranche(), resize_intArrayType(), SetConstraintStateAddItem(), setup_regexp_matches(), smgrDoPendingDeletes(), SnapBuildAddCommittedTxn(), socket_putmessage_noblock(), SPI_connect(), SPI_repalloc(), TidListEval(), tsqueryrecv(), tsvectorin(), tsvectorrecv(), tuplestore_alloc_read_pointer(), uniqueentry(), uniqueWORD(), variable_paramref_hook(), and XLogEnsureRecordSpace().

964 {
965  MemoryContext context = GetMemoryChunkContext(pointer);
966  void *ret;
967 
968  if (!AllocSizeIsValid(size))
969  elog(ERROR, "invalid memory alloc request size %zu", size);
970 
972 
973  /* isReset must be false already */
974  Assert(!context->isReset);
975 
976  ret = (*context->methods->realloc) (context, pointer, size);
977  if (ret == NULL)
978  {
980  ereport(ERROR,
981  (errcode(ERRCODE_OUT_OF_MEMORY),
982  errmsg("out of memory"),
983  errdetail("Failed on request of size %zu.", size)));
984  }
985 
986  VALGRIND_MEMPOOL_CHANGE(context, pointer, ret, size);
987 
988  return ret;
989 }
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
#define VALGRIND_MEMPOOL_CHANGE(context, optr, nptr, size)
Definition: memdebug.h:31
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
MemoryContext TopMemoryContext
Definition: mcxt.c:43
#define AllocSizeIsValid(size)
Definition: memutils.h:42
void *(* realloc)(MemoryContext context, void *pointer, Size size)
Definition: memnodes.h:59
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:675
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
static MemoryContext GetMemoryChunkContext(void *pointer)
Definition: memutils.h:107
void* repalloc_huge ( void *  pointer,
Size  size 
)

Definition at line 1031 of file mcxt.c.

References AllocHugeSizeIsValid, Assert, AssertNotInCriticalSection, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, GetMemoryChunkContext(), MemoryContextData::isReset, MemoryContextStats(), MemoryContextData::methods, NULL, MemoryContextMethods::realloc, and VALGRIND_MEMPOOL_CHANGE.

Referenced by enlargeStringInfo(), ginCombineData(), grow_memtuples(), and spi_printtup().

1032 {
1033  MemoryContext context = GetMemoryChunkContext(pointer);
1034  void *ret;
1035 
1036  if (!AllocHugeSizeIsValid(size))
1037  elog(ERROR, "invalid memory alloc request size %zu", size);
1038 
1039  AssertNotInCriticalSection(context);
1040 
1041  /* isReset must be false already */
1042  Assert(!context->isReset);
1043 
1044  ret = (*context->methods->realloc) (context, pointer, size);
1045  if (ret == NULL)
1046  {
1048  ereport(ERROR,
1049  (errcode(ERRCODE_OUT_OF_MEMORY),
1050  errmsg("out of memory"),
1051  errdetail("Failed on request of size %zu.", size)));
1052  }
1053 
1054  VALGRIND_MEMPOOL_CHANGE(context, pointer, ret, size);
1055 
1056  return ret;
1057 }
MemoryContextMethods * methods
Definition: memnodes.h:79
int errcode(int sqlerrcode)
Definition: elog.c:575
#define AssertNotInCriticalSection(context)
Definition: mcxt.c:64
#define ERROR
Definition: elog.h:43
#define VALGRIND_MEMPOOL_CHANGE(context, optr, nptr, size)
Definition: memdebug.h:31
void MemoryContextStats(MemoryContext context)
Definition: mcxt.c:438
int errdetail(const char *fmt,...)
Definition: elog.c:873
#define ereport(elevel, rest)
Definition: elog.h:122
MemoryContext TopMemoryContext
Definition: mcxt.c:43
void *(* realloc)(MemoryContext context, void *pointer, Size size)
Definition: memnodes.h:59
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:675
#define AllocHugeSizeIsValid(size)
Definition: memutils.h:46
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
static MemoryContext GetMemoryChunkContext(void *pointer)
Definition: memutils.h:107

Variable Documentation

PGDLLIMPORT MemoryContext CurrentMemoryContext

Definition at line 37 of file mcxt.c.

Referenced by _bt_load(), _bt_preprocess_array_keys(), _hash_finish_split(), _SPI_save_plan(), advance_combine_function(), advance_transition_function(), advance_windowaggregate(), advance_windowaggregate_base(), afterTriggerInvokeEvents(), AllocateSnapshotBuilder(), array_agg_array_finalfn(), array_agg_finalfn(), array_positions(), array_to_datum_internal(), begin_heap_rewrite(), BeginCopy(), blbuild(), blinsert(), brin_build_desc(), brin_new_memtuple(), bringetbitmap(), brininsert(), bt_check_every_level(), btvacuumscan(), build_join_rel_hash(), BuildCachedPlan(), BuildIndexInfo(), CheckIndexCompatible(), CompactCheckpointerRequestQueue(), CompleteCachedPlan(), compute_array_stats(), compute_scalar_stats(), compute_tsvector_stats(), CopyCachedPlan(), CopyErrorData(), CopyFrom(), CopyTo(), create_toast_table(), CreateCachedPlan(), CreateExecutorState(), CreateOneShotCachedPlan(), CreateSchemaCommand(), CreateStandaloneExprContext(), createTempGistContext(), createTrgmNFA(), CreateTupleQueueDestReceiver(), CreateTupleQueueReader(), DatumGetExpandedArray(), DatumGetExpandedArrayX(), datumTransfer(), dblink_get_connections(), DefineIndex(), DiscreteKnapsack(), do_analyze_rel(), do_start_worker(), domain_check(), dsnowball_init(), each_worker(), each_worker_jsonb(), elements_worker(), elements_worker_jsonb(), ensure_transaction(), eval_windowfunction(), EventTriggerInvoke(), exec_assign_value(), exec_replication_command(), exec_stmt_block(), ExecHashTableCreate(), ExecInitCoerceToDomain(), ExecInitFunctionScan(), ExecInitGatherMerge(), ExecInitIndexScan(), ExecInitMergeAppend(), ExecInitRecursiveUnion(), ExecInitSetOp(), ExecInitSubPlan(), ExecInitTableFuncScan(), ExecInitUnique(), ExecInitWindowAgg(), ExecMakeTableFunctionResult(), ExecScanSubPlan(), ExecSetParamPlan(), fetch_array_arg_replace_nulls(), file_acquire_sample_rows(), fill_hba_view(), finalize_aggregate(), finalize_partialaggregate(), finalize_windowaggregate(), find_all_inheritors(), fmgr_info(), fmgr_info_other_lang(), geqo_eval(), get_altertable_subcmdtypes(), get_database_list(), get_json_object_as_hash(), get_subscription_list(), GetErrorContextStack(), gin_extract_query_trgm(), gin_xlog_startup(), ginbeginscan(), ginbuild(), ginbulkdelete(), gininsert(), ginInsertCleanup(), ginPlaceToPage(), gistbuild(), gistInitBuildBuffers(), gistInitParentMap(), heap_form_tuple(), IdentifySystem(), initBloomState(), initGinState(), initGISTstate(), initialize_peragg(), initTrie(), inline_function(), inline_set_returning_function(), libpqrcv_processTuples(), load_domaintype_info(), load_tzoffsets(), makeNumericAggStateCurrentContext(), MakeTupleTableSlot(), materializeQueryResult(), MemoryContextSwitchTo(), MJExamineQuals(), multi_sort_add_dimension(), NextCopyFrom(), optionListToArray(), ParallelWorkerMain(), parse_ident(), parseCheckAggregates(), pg_buffercache_pages(), pgstat_collect_oids(), plan_cluster_use_sort(), plperl_array_to_datum(), plperl_inline_handler(), plperl_return_next(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), plpgsql_compile_inline(), plpgsql_estate_setup(), plpgsql_exec_function(), plpgsql_inline_handler(), plpgsql_validator(), plpython_inline_handler(), pltcl_elog(), pltcl_returnnext(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), pltcl_SPI_prepare(), pltcl_subtransaction(), PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_cursor_plan(), PLy_cursor_query(), PLy_output(), PLy_spi_execute_fetch_result(), PLy_spi_execute_plan(), PLy_spi_execute_query(), PLy_spi_prepare(), PLy_subtransaction_enter(), PLyDict_FromTuple(), PLyObject_ToComposite(), PLyString_ToComposite(), populate_recordset_object_start(), PortalRun(), PortalRunMulti(), postgresAcquireSampleRowsFunc(), postquel_start(), pq_parse_errornotice(), printtup_startup(), ProcessCompletedNotifies(), publicationListToArray(), pull_up_simple_subquery(), regexp_split_to_array(), RelationBuildRowSecurity(), ReorderBufferAllocate(), ResetUnloggedRelations(), RevalidateCachedQuery(), ScanKeyEntryInitializeWithInfo(), set_rtable_names(), shm_mq_attach(), spg_xlog_startup(), spgbeginscan(), spgbuild(), spginsert(), spi_dest_startup(), startScanKey(), StartupDecodingContext(), strlist_to_textarray(), subquery_planner(), tbm_create(), text_to_array_internal(), tokenize_file(), transformGraph(), transformRelOptions(), tsquery_rewrite_query(), tuple_data_split_internal(), tuplesort_begin_cluster(), tuplesort_begin_common(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_begin_index_btree(), tuplestore_begin_common(), union_tuples(), WaitLatchOrSocket(), write_console(), xml_is_document(), and xpath().