- All Superinterfaces:
Lifespan
MemoryContext
, which is usable as a PL/Java
Lifespan
to scope the lifetimes of PL/Java objects
(as when they depend on native memory allocated in the underlying context).
The MemoryContext
API in PostgreSQL is described here.
Static getters for the globally known contexts are spelled and capitalized as they are in PostgreSQL.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MemoryContext
The top level of the context tree, of which every other context is a descendant. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryContext
The "current" memory context, which supplies all allocations made by PostgreSQLpalloc
and related functions that do not explicitly specify a context.static MemoryContext
The same asTopTransactionContext
when in a top-level transaction, but different in subtransactions (such as those associated with PL/Java savepoints).static MemoryContext
A permanent context switched into for error recovery processing.static MemoryContext
A long-lived, never-reset context created by PL/Java as a child ofTopMemoryContext
.static MemoryContext
Context of the currently active execution portal.static MemoryContext
Getter method equivalent to the finalTopMemoryContext
field, for consistency with the other static getters.static MemoryContext
Holds everything that lives until end of the top-level transaction.static MemoryContext
The "upper executor" memory context (that is, the context on entry, prior to any use of SPI) associated with the current (innermost) PL/Java function invocation.
-
Field Details
-
TopMemoryContext
The top level of the context tree, of which every other context is a descendant.Used as described here.
-
-
Method Details
-
CurrentMemoryContext
The "current" memory context, which supplies all allocations made by PostgreSQLpalloc
and related functions that do not explicitly specify a context.Used as described here.
-
TopMemoryContext
Getter method equivalent to the finalTopMemoryContext
field, for consistency with the other static getters. -
TopTransactionContext
Holds everything that lives until end of the top-level transaction.Can be appropriate when a specification, for example JDBC, provides that an object should remain valid for the life of the transaction.
Uses are described here.
-
CurTransactionContext
The same asTopTransactionContext
when in a top-level transaction, but different in subtransactions (such as those associated with PL/Java savepoints).Used as described here.
-
PortalContext
Context of the currently active execution portal.Used as described here.
-
ErrorContext
A permanent context switched into for error recovery processing.Used as described here.
-
JavaMemoryContext
A long-lived, never-reset context created by PL/Java as a child ofTopMemoryContext
.Perhaps useful for PL/Java-related allocations that will be long-lived, or managed only from the Java side, as a way of accounting for them separately, as opposed to just putting them in
TopMemoryContext
. It hasn't been used consistently even in the historical PL/Java code base, and should perhaps be a candidate for deprecation (or for a thorough code review to establish firmer guidelines for its use). -
UpperMemoryContext
The "upper executor" memory context (that is, the context on entry, prior to any use of SPI) associated with the current (innermost) PL/Java function invocation.This is "precisely the right context for a value returned" from a function that uses SPI, as described here.
-