dbms: SmallObjectPool: fix odr-use in debug build

This commit is contained in:
Andrey Mironov 2015-12-08 12:16:33 +03:00
parent a57f996770
commit c8e3d90536

View File

@ -15,12 +15,12 @@ namespace DB
/** Can allocate memory objects of fixed size with deletion support.
* For `object_size` less than `min_allocation_size` still allocates `min_allocation_size` bytes. */
* For small `object_size`s allocated no less than getMinAllocationSize() bytes. */
class SmallObjectPool
{
private:
struct Block { Block * next; };
static constexpr auto min_allocation_size = sizeof(Block);
static constexpr auto getMinAllocationSize() { return sizeof(Block); }
const std::size_t object_size;
Arena pool;
@ -30,7 +30,7 @@ public:
SmallObjectPool(
const std::size_t object_size_, const std::size_t initial_size = 4096, const std::size_t growth_factor = 2,
const std::size_t linear_growth_threshold = 128 * 1024 * 1024)
: object_size{std::max(object_size_, min_allocation_size)},
: object_size{std::max(object_size_, getMinAllocationSize())},
pool{initial_size, growth_factor, linear_growth_threshold}
{
if (pool.size() < object_size)