CETL 0.0.0
 
Loading...
Searching...
No Matches
Example 11: Using the 01heap memory_resource

Full example for cetl::pmr::UnsynchronizedO1HeapMemoryResourceDelegate

#include <gtest/gtest.h>
namespace cetl
{
namespace pf17
{
TEST(example_11_memory_resource_o1heap, main)
{
// We'll use the aligned-storage helper class to defined properly aligned storage for the 01-heap areana. As this
// is a large chunk we'll make it static to keep it off the stack.
// Now we can use our test subject to allocate and deallocate memory.
// Note that, until https://github.com/pavel-kirienko/o1heap/issues/13 is fixed the alignment doesn't have
// any effect on allocation requests.
void* mem = test_subject.allocate(8);
ASSERT_NE(nullptr, mem);
test_subject.deallocate(mem, 8);
}
}// namespace pf17
}// namespace cetl
Definition o1heap_memory_resource_delegate.hpp:48
This namespace contains types specific to CETL and nested namespaces that contain types adhering to t...
Definition _helper_enable_copy_move.hpp:10
Defines cetl::pmr::O1HeapMemoryResource which is a std::pmr::memory_resource implemented in terms of ...
Definition o1heap_memory_resource_delegate.hpp:34