diff --git a/include/metall/container/fallback_allocator.hpp b/include/metall/container/fallback_allocator.hpp index 4b10d51e..f7da85c0 100644 --- a/include/metall/container/fallback_allocator.hpp +++ b/include/metall/container/fallback_allocator.hpp @@ -12,9 +12,9 @@ namespace metall::container { -/// \brief A STL compatible allocator which fallbacks to a heap allocator (e.g., -/// malloc()) if its constructor receives no argument to construct the stateful -/// allocator instance. +/// \brief A Metall STL compatible allocator which fallbacks to a heap allocator +/// (e.g., malloc()) if its constructor receives no argument to construct the +/// stateful allocator (Metall's normal STL compatible allocator) instance. /// \tparam StatefulAllocator The stateful allocator type. It must not be /// default constructible. template @@ -69,7 +69,7 @@ class fallback_allocator_adaptor { fallback_allocator_adaptor( fallback_allocator_adaptor allocator_instance) noexcept - : m_stateful_allocator(allocator_instance.stateful_allocator()) {} + : m_stateful_allocator(allocator_instance.get_stateful_allocator()) {} /// \brief Construct a new instance using an instance of any /// stateful_allocator. @@ -202,10 +202,10 @@ class fallback_allocator_adaptor { // ---------- This class's unique public functions ---------- // /// \brief Returns a reference to the stateful allocator. - stateful_allocator_type &stateful_allocator() { return m_stateful_allocator; } + stateful_allocator_type &get_stateful_allocator() { return m_stateful_allocator; } /// \brief Returns a const reference to the stateful allocator. - const stateful_allocator_type &stateful_allocator() const { + const stateful_allocator_type &get_stateful_allocator() const { return m_stateful_allocator; } @@ -259,7 +259,7 @@ inline bool operator==( const fallback_allocator_adaptor &rhd, const fallback_allocator_adaptor &lhd) { // Return true if they point to the same manager kernel - return rhd.stateful_allocator() == lhd.stateful_allocator(); + return rhd.get_stateful_allocator() == lhd.get_stateful_allocator(); } template diff --git a/test/container/fallback_allocator_test.cpp b/test/container/fallback_allocator_test.cpp index 9d43b24c..e207d457 100644 --- a/test/container/fallback_allocator_test.cpp +++ b/test/container/fallback_allocator_test.cpp @@ -107,6 +107,13 @@ TEST(FallbackAllocatorAdaptorTest, Types) { alloc); GTEST_ASSERT_EQ(alloc, a2); } + + { + metall::manager manager(metall::create_only, dir_path(), + 1UL << 27UL); + auto allocator = fb_alloc_type(manager.get_allocator()); + ASSERT_EQ(allocator.get_stateful_allocator(), manager.get_allocator()); + } } TEST(FallbackAllocatorAdaptorTest, Availability) {