10 static const int kBlockSize = 4096;
19 for (
size_t i = 0; i <
blocks_.size(); i++) {
25 if (bytes > kBlockSize / 4) {
43 const int align =
sizeof(
void*);
44 assert((align & (align-1)) == 0);
45 size_t current_mod =
reinterpret_cast<uintptr_t
>(
alloc_ptr_) & (align-1);
46 size_t slop = (current_mod == 0 ? 0 : align - current_mod);
47 size_t needed = bytes + slop;
57 assert((reinterpret_cast<uintptr_t>(result) & (align-1)) == 0);
62 char* result =
new char[block_bytes];
size_t alloc_bytes_remaining_
char * AllocateNewBlock(size_t block_bytes)
char * AllocateFallback(size_t bytes)
std::vector< char * > blocks_
char * AllocateAligned(size_t bytes)