MCPcopy Create free account
hub / github.com/documentdb/documentdb / FreeExprEvalState

Function FreeExprEvalState

pg_documentdb/src/query/bson_expr_eval.c:360–390  ·  view source on GitHub ↗

Frees the resources of a ExprEvalState heap object. * This should only be used on an ExprEvalState created on the same memory context using the * GetExpressionEvalState* functions. */

Source from the content-addressed store, hash-verified

358 * This should only be used on an ExprEvalState created on the same memory context using the
359 * GetExpressionEvalState* functions. */
360void
361FreeExprEvalState(ExprEvalState *exprEvalState, MemoryContext memoryContext)
362{
363 if (exprEvalState != NULL)
364 {
365 MemoryContext originalMemoryContext = MemoryContextSwitchTo(memoryContext);
366
367 if (exprEvalState->estate != NULL)
368 {
369 /* this will destroy the executor state memory context which holds exprState and exprContext. */
370 FreeExecutorState(exprEvalState->estate);
371 exprEvalState->estate = NULL;
372 }
373
374 if (exprEvalState->datums != NULL)
375 {
376 pfree(exprEvalState->datums);
377 exprEvalState->datums = NULL;
378 }
379
380 if (exprEvalState->tupleSlot != NULL)
381 {
382 ExecDropSingleTupleTableSlot(exprEvalState->tupleSlot);
383 exprEvalState->tupleSlot = NULL;
384 }
385
386 pfree(exprEvalState);
387
388 MemoryContextSwitchTo(originalMemoryContext);
389 }
390}
391
392
393/* --------------------------------------------------------- */

Callers 5

ProcessBatchInsertionFunction · 0.85
ProcessFindAndModifySpecFunction · 0.85
PerformUpdateCoreFunction · 0.85
command_update_workerFunction · 0.85
EvaluateInverseMatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected