134
an application with persistent memory usage may still prove challenging without
a lot of niceties that the C++ programmers are used to. The natural step forward to
make persistent programming easier was to provide programmers with efficient and
useful containers.
Persistent Containers
The C++ standard library containers collection is something that persistent memory
programmers may want to use. Containers manage the lifetime of held objects
through allocation/creation and deallocation/destruction with the use of allocators.
Implementing custom persistent allocator for C++ STL (Standard Template Library)
containers has two main downsides:
• Implementation details:
• STL containers do not use algorithms optimal for a persistent
memory programming point of view.
• Persistent memory containers should have durability and
consistency properties, while not every STL method guarantees
strong exception safety.
• Persistent memory containers should be designed with an
awareness of fragmentation limitations.
• Memory layout:
• The STL does not guarantee that the container layout will remain
unchanged in new library versions.
Due to these obstacles, the libpmemobj-cpp contains the set of custom,
implemented-from-scratch, containers with optimized on-media layouts and
algorithms to fully exploit the potential and features of persistent memory. These
methods guarantee atomicity, consistency, and durability. Besides specific internal
implementation details, libpmemobj-cpp persistent memory containers have a wellknown STL-like interface, and they work with STL algorithms.
Chapter 8 libpmemobj-Cpp: the adaptable language - C++ and persistent memory
an application with persistent memory usage may still prove challenging without
a lot of niceties that the C++ programmers are used to. The natural step forward to
make persistent programming easier was to provide programmers with efficient and
useful containers.
Persistent Containers
The C++ standard library containers collection is something that persistent memory
programmers may want to use. Containers manage the lifetime of held objects
through allocation/creation and deallocation/destruction with the use of allocators.
Implementing custom persistent allocator for C++ STL (Standard Template Library)
containers has two main downsides:
• Implementation details:
• STL containers do not use algorithms optimal for a persistent
memory programming point of view.
• Persistent memory containers should have durability and
consistency properties, while not every STL method guarantees
strong exception safety.
• Persistent memory containers should be designed with an
awareness of fragmentation limitations.
• Memory layout:
• The STL does not guarantee that the container layout will remain
unchanged in new library versions.
Due to these obstacles, the libpmemobj-cpp contains the set of custom,
implemented-from-scratch, containers with optimized on-media layouts and
algorithms to fully exploit the potential and features of persistent memory. These
methods guarantee atomicity, consistency, and durability. Besides specific internal
implementation details, libpmemobj-cpp persistent memory containers have a wellknown STL-like interface, and they work with STL algorithms.
Chapter 8 libpmemobj-Cpp: the adaptable language - C++ and persistent memory
