MCPcopy Create free account
hub / github.com/apache/cloudberry / SPI_ReserveMemory

Function SPI_ReserveMemory

src/backend/executor/spi.c:3497–3510  ·  view source on GitHub ↗

* Push memory reserved for next SPI call. It is possible for an operator to (after several levels of nesting), * result in execution of SQL statements via SPI e.g. a pl/pgsql function that issues queries. These queries must be sandboxed into * the memory limits of the operator. This stack represents the nesting of these operators and each * operator will push its own limit. */

Source from the content-addressed store, hash-verified

3495 * operator will push its own limit.
3496 */
3497void SPI_ReserveMemory(uint64 mem_reserved)
3498{
3499 Assert(!IsResManagerMemoryPolicyNone());
3500 if (mem_reserved > 0
3501 && (SPIMemReserved == 0 || mem_reserved < SPIMemReserved))
3502 {
3503 SPIMemReserved = mem_reserved;
3504 }
3505
3506 if (LogResManagerMemory())
3507 {
3508 elog(GP_RESMANAGER_MEMORY_LOG_LEVEL, "SPI memory reservation %d", (int) SPIMemReserved);
3509 }
3510}
3511
3512/**
3513 * What was the amount of memory reserved for the last operator? See SPI_ReserveMemory()

Callers 2

ExecInitResultFunction · 0.85
ExecInitFunctionScanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected