1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef FASTRTPS_UTILS_COLLECTIONS_FOONATHAN_MEMORY_HELPERS_HPP_
- #define FASTRTPS_UTILS_COLLECTIONS_FOONATHAN_MEMORY_HELPERS_HPP_
- #include <foonathan/memory/memory_pool.hpp>
- #include <foonathan/memory/detail/debug_helpers.hpp>
- #include "ResourceLimitedContainerConfig.hpp"
- namespace eprosima {
- namespace fastrtps {
- template <typename MemoryPool>
- std::size_t memory_pool_block_size(
- std::size_t node_size,
- const ResourceLimitedContainerConfig& limits)
- {
- size_t num_elems = limits.increment > 0 ? limits.initial : limits.maximum;
- if (num_elems < 1u)
- {
- num_elems = 1u;
- }
- return num_elems
- * ((node_size > MemoryPool::min_node_size ? node_size : MemoryPool::min_node_size)
- * (foonathan::memory::detail::debug_fence_size ? 3 : 1))
- + foonathan::memory::detail::memory_block_stack::implementation_offset;
- }
- }
- }
- #endif
|