static constexpr size_t kDefaultMinBlockSize = 4096 - sizeof(Block);
static constexpr size_t kNoSizeLimit = 0;
static constexpr size_t kDefaultMaxAlign = alignof(Block);
+ static constexpr size_t kBlockOverhead = sizeof(Block);
private:
bool isAligned(uintptr_t address) const {
size_t* ptr = static_cast<size_t*>(arena.allocate(sizeof(long)));
allocatedItems.insert(ptr);
minimum_size += requestedBlockSize;
- maximum_size += goodMallocSize(requestedBlockSize + 1);
+ maximum_size += goodMallocSize(requestedBlockSize + SysArena::kBlockOverhead);
EXPECT_TRUE(arena.totalSize() >= minimum_size);
EXPECT_TRUE(arena.totalSize() <= maximum_size);
VLOG(4) << minimum_size << " < " << arena.totalSize() << " < "
allocatedItems.insert(ptr);
}
minimum_size += 10 * requestedBlockSize;
- maximum_size += 10 * goodMallocSize(requestedBlockSize + 1);
+ maximum_size += 10 * goodMallocSize(requestedBlockSize
+ + SysArena::kBlockOverhead);
EXPECT_TRUE(arena.totalSize() >= minimum_size);
EXPECT_TRUE(arena.totalSize() <= maximum_size);
VLOG(4) << minimum_size << " < " << arena.totalSize() << " < "
ptr = static_cast<size_t*>(arena.allocate(10 * requestedBlockSize));
allocatedItems.insert(ptr);
minimum_size += 10 * requestedBlockSize;
- maximum_size += goodMallocSize(10 * requestedBlockSize + 1);
+ maximum_size += goodMallocSize(10 * requestedBlockSize
+ + SysArena::kBlockOverhead);
EXPECT_TRUE(arena.totalSize() >= minimum_size);
EXPECT_TRUE(arena.totalSize() <= maximum_size);
VLOG(4) << minimum_size << " < " << arena.totalSize() << " < "