X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FArena-inl.h;h=805e8616acc190ccb41bcabfce03359304c93cab;hb=6c4a55d047861f08753fc2a938abe9da75369add;hp=d97ea6973700f42431d4ab76975c67d220f4d8b4;hpb=5e3674ca805202eee22829ee936c11a38dabd6ab;p=folly.git diff --git a/folly/Arena-inl.h b/folly/Arena-inl.h index d97ea697..805e8616 100644 --- a/folly/Arena-inl.h +++ b/folly/Arena-inl.h @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ Arena::Block::allocate(Alloc& alloc, size_t size, bool allowSlack) { } void* mem = alloc.allocate(allocSize); - assert(isAligned(mem)); return std::make_pair(new (mem) Block(), allocSize - sizeof(Block)); } @@ -46,9 +45,9 @@ void* Arena::allocateSlow(size_t size) { std::pair p; char* start; - size_t allocSize = std::max(size, minBlockSize()) + sizeof(Block); - if(sizeLimit_ && allocSize > sizeLimit_ - totalAllocatedSize_) { + if (sizeLimit_ != kNoSizeLimit && + allocSize > sizeLimit_ - totalAllocatedSize_) { throw std::bad_alloc(); }