18 for (
size_t i = 0; i <
blocks_.size(); i++) {
24 if (bytes > kBlockSize / 4) {
42 const int align = (
sizeof(
void*) > 8) ?
sizeof(
void*) : 8;
43 assert((align & (align-1)) == 0);
44 size_t current_mod =
reinterpret_cast<uintptr_t
>(
alloc_ptr_) & (align-1);
45 size_t slop = (current_mod == 0 ? 0 : align - current_mod);
46 size_t needed = bytes + slop;
56 assert((reinterpret_cast<uintptr_t>(result) & (align-1)) == 0);
61 char* result =
new char[block_bytes];
64 reinterpret_cast<void*>(
MemoryUsage() + block_bytes +
sizeof(
char*)));
char * AllocateAligned(size_t bytes)
static const int kBlockSize
size_t MemoryUsage() const
char * AllocateNewBlock(size_t block_bytes)
port::AtomicPointer memory_usage_
std::vector< char * > blocks_
char * AllocateFallback(size_t bytes)
size_t alloc_bytes_remaining_