- size_t minBlockSize = kDefaultMinBlockSize)
- : allocAndSize_(alloc, minBlockSize),
- ptr_(nullptr),
- end_(nullptr) {
+ size_t minBlockSize = kDefaultMinBlockSize,
+ size_t sizeLimit = kNoSizeLimit,
+ size_t maxAlign = kDefaultMaxAlign)
+ : allocAndSize_(alloc, minBlockSize)
+ , ptr_(nullptr)
+ , end_(nullptr)
+ , totalAllocatedSize_(0)
+ , bytesUsed_(0)
+ , sizeLimit_(sizeLimit)
+ , maxAlign_(maxAlign) {
+ if ((maxAlign_ & (maxAlign_ - 1)) || maxAlign_ > alignof(Block)) {
+ throw std::invalid_argument(
+ folly::to<std::string>("Invalid maxAlign: ", maxAlign_));
+ }