
GOTO - The Brightest Minds in Tech C++ Memory Management • Patrice Roy & Kevin Carpenter
Dec 9, 2025
Patrice Roy, a seasoned C++ programmer with three decades of experience and a member of the C++ Standards Committee, joins Kevin Carpenter to dive deep into memory management. They discuss critical pitfalls like over-allocation, the advantages of smart pointers, and the role of modern tools in enhancing code safety. Patrice shares insights from his book and provides best practices for new developers, emphasizing the importance of using standard containers and measuring performance before optimizing. The conversation also touches on custom allocators and instrumentation techniques for optimizing memory usage.
AI Snips
Chapters
Books
Transcript
Episode notes
Prefer Value Semantics First
- Prefer value semantics and standard containers over manual dynamic allocation when possible.
- Use dynamic allocation only when you can measure a real need and manage it with proper abstractions.
Legacy Pointer Arithmetic Still Blazing Fast
- Kevin describes an MFC app doing pointer arithmetic over a large double array that was extremely fast.
- Patrice suggests vector or span as safer alternatives without losing speed if used correctly.
Make Ownership Intent Explicit
- Use raw pointers as non-owning observers and unique_ptr for single ownership; prefer shared_ptr only for shared responsibility.
- Expose raw pointers from owners (e.g., unique_ptr::get) for consumers that must not own the resource.

