C++Now 2019 has ended
Back To Schedule
Monday, May 6 • 16:30 - 18:00
test_resource: the pmr detective

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
This session will provide an introduction to pmr::test_resource, which supports testing memory allocation related behavior on a per-object basis.

pmr::test_resource is a C++17 memory resource designed for testing that can be plugged into any test framework. It is the modernized version of the bslma::TestAllocator used in production for over two decades at Bloomberg, where it has helped to expose a variety of bugs, such as memory leaks, overruns, multiple deletes, exception-safety guarantee failures etc. This presentation will show the use of test_resource in detecting errors related to memory allocation. We walk through code to demonstrate several bugs and show how they misbehave, how we diagnose them, and a reasonable fix. pmr::test_resource is being proposed for the Library Fundamentals 3 TS and full
source code for test_resource, bslma::TestAllocator and the examples is available on GitHub.

avatar for Attila Feher

Attila Feher

Senior Software Engineer, Bloomberg LP
Working with C++. Original proposer of the C++11 alignment features.

Monday May 6, 2019 16:30 - 18:00 MDT