Event language
UI language
Are you a PostgreSQL developer or aspiring contributor ready to dive into the C source code? Memory management is a common roadblock, but it's also the secret to PostgreSQL's legendary stability. This beginner-friendly talk demystifies PostgreSQL's unique Memory Context system—a fundamental technique for controlling memory based on a data's expected lifespan (e.g., a single query or transaction). We'll cover why traditional C malloc/free leads to leaks in a long-running database, explore the critical Memory Context hierarchy (TopMemoryContext, CacheMemoryContext, etc.), and show you the core C functions and structures that make it work. Finally, you will learn how to debug memory usage with built-in views and functions, equipping you with the essential knowledge to write your first bug-free PostgreSQL code.