test_resource: The pmr Detective
summary
pmr::test_resource is a C++17 polymorphic memory resource (based on Bloomberg’s bslma::TestAllocator) that detects leaks, buffer overruns/underruns, double frees and wrong-size/ alignment frees; it counts blocks/bytes, prints verbose allocation traces, and aborts on leak by default. Examples walk through a broken PString that misses a terminator, copy/move mishandles and a per-object exception injection loop that verifies strong exception safety using monitoring snapshots and a default-resource guard; full source and examples live on GitHub and are proposed for Library Fundamentals 3 TS.
AI-written summary · about
chapters (19)
- 0:00Intro
- 7:50Design
- 9:28Functions
- 11:06Deck
- 12:21Memory Resource
- 14:50Polymorphic A Locator
- 19:07Test Resource Example
- 21:46Test Resource Implementation
- 26:10Memory Leaks
- 28:02Buffer Overrun
- 30:30Undefined Behavior
- 32:34Public Lead
- 34:13Vector
- 36:11Test
- 41:22Test resource
- 43:03allocations
- 48:29when to use
- 51:08call to action
- 52:46QA
related talks
55mUsing the Valgrind Framework to Build a Persistent Memory Error Detector
52mFantastic C++ Bugs and How to Test Them
59mC++ Unit testing - the good, the bad & the ugly
58mProperty Based Testing: Concepts and Examples
58mTest Driven C++ with Catch
42mSurprise yourself with Property Based Testing
01h 01mBreaking your REST APIs to make them stronger!!
46mTestability and C++ API Design
