just use default policy for chunk_variable_alloc

This commit is contained in:
mutouyun 2019-07-03 21:56:28 +08:00
parent 449bc36bd9
commit 3d46bcd47a

View File

@ -17,27 +17,7 @@
namespace ipc { namespace ipc {
namespace mem { namespace mem {
template <std::size_t Size> using chunk_variable_alloc = variable_alloc<sizeof(void*) * 1024 * 1024 /* 8MB(x64) */>;
using static_sync_fixed = static_wrapper<async_wrapper<fixed_alloc<Size, static_alloc>>>;
namespace detail {
struct chunk_mapping_policy {
enum : std::size_t {
base_size = sizeof(void*) * 1024 * 1024, /* 8MB(x64) */
classes_size = 1
};
constexpr static std::size_t classify(std::size_t size) {
return (size <= base_size) ? 0 : static_cast<std::size_t>(classes_size);
}
};
} // namespace detail
using static_chunk_alloc = variable_wrapper<static_sync_fixed, detail::chunk_mapping_policy>;
using chunk_variable_alloc = variable_alloc<detail::chunk_mapping_policy::base_size, static_chunk_alloc>;
template <std::size_t Size> template <std::size_t Size>
using static_async_fixed = static_wrapper<async_wrapper<fixed_alloc<Size, chunk_variable_alloc>>>; using static_async_fixed = static_wrapper<async_wrapper<fixed_alloc<Size, chunk_variable_alloc>>>;