Function pgx_pg_sys::GetMemoryContextChunk
source · pub unsafe fn GetMemoryContextChunk(pointer: *mut c_void) -> MemoryContextExpand description
Given a currently-allocated chunk of Postgres allocated memory, determine the context it belongs to.
All chunks allocated by any memory context manager are required to be preceded by the corresponding MemoryContext stored, without padding, in the preceding sizeof(void*) bytes. A currently-allocated chunk must contain a backpointer to its owning context. The backpointer is used by pfree() and repalloc() to find the context to call.
Safety
The specified pointer must be one allocated by Postgres (via [palloc] and friends).
Panics
This function will panic if pointer is null, if it’s not properly aligned, or if the memory
it points do doesn’t have the a header that looks like a memory context pointer