Subject: [Boost-bugs] [Boost C++ Libraries] #1252: [pool] severe overhead with unaligned sizes.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-09-12 21:05:40
#1252: [pool] severe overhead with unaligned sizes.
-------------------------------+--------------------------------------------
Reporter: phrosty_at_[hidden] | Type: Bugs
Status: new | Milestone: Boost 1.35.0
Component: None | Version: Boost 1.34.1
Severity: Problem | Keywords: pool
-------------------------------+--------------------------------------------
Pool will set the size of allocated blocks to the least common multiple of
the requested size and LCM(sizeof(void*), sizeof(size_t)).
Request a block size of 1500 on a 32-bit system and you get 1500 byte
blocks. Request 1501 bytes and you get 6004 byte blocks - and the extra
space isn't ever used. It is obviously even more pronounced on a 64-bit
system.
I believe the intent of the author was to align block sizes, not to use
LCM. I propose changing pool.hpp:183 from
`return details::pool::lcm<size_type>(requested_size, min_size);`
to
`return requested_size + (min_size - 1) & ~(min_size - 1);`
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1252>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC