~/talk

All in a context!

Talkat PostgreSQL Conference Europe 2025 · 2025-10-21..10-24· [databases]
links:none on file
slides:none on file

PostgreSQL routes every malloc into hierarchical memory contexts so code never calls free directly, using allocation sets of 8 KB that double on growth and a free list reuse to avoid repeated creation. Contexts expose APIs like memory_context_create/reset/delete, memory_context_switch and alloc/alloc_zero/alloc_extended, callbacks that run on reset in reverse child→parent order, and PG backend memory_context view plus enable C_ASSERT and memory_context_stats for debugging. Setting a context parent extends its lifetime.

AI-written summary · about

  1. 0:00Introduction and setup
  2. 1:49Why memory context exists
  3. 3:36Memory context structure
  4. 6:03Memory context methods
  5. 7:27Free list mechanism
  6. 8:54Memory context callbacks
  7. 9:56Basic operations in context
  8. 10:39Context organization in Postgres
  9. 11:44Key memory contexts
  10. 13:31Other specialized contexts
  11. 14:55Current context and allocation
  12. 16:00Creating a memory context
  13. 17:03Deleting and resetting contexts
  14. 18:29Switching and allocating in context
  15. 19:11Inquiry and debugging functions
  16. 20:18Viewing memory context stats
  17. 21:24Detecting memory leaks
  18. 24:35Advantages of memory context
  19. 26:45Summary and conclusion
  20. 27:08Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.