Memory context (MemoryContext)
Also called: MemoryContext, allocation arena, mcxt
A memory context is a named arena that owns a group of allocations. PostgreSQL allocates from the current context with palloc and, instead of freeing objects one by one, resets or deletes the whole context, reclaiming every allocation inside it at once. Contexts form a tree rooted at TopMemoryContext; deleting a parent frees all its children.
What this means
Instead of freeing memory one allocation at a time, Postgres groups allocations into named arenas. You allocate into the current arena, and when that piece of work is done you reset or delete the whole arena at once, every allocation inside it vanishes together. It's how the server keeps from leaking memory across millions of queries.
Why it matters operationally
This is how PostgreSQL avoids leaks despite rarely calling free: when a query or a single tuple's processing ends, its context is wiped wholesale. It also makes memory diagnosable, each context is named, so you can see exactly which arena is consuming RAM.