diff --git a/compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp b/compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp --- a/compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp +++ b/compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp @@ -69,12 +69,14 @@ void *Ptrs[NumIters]; for (auto _ : State) { + size_t SizeLog2 = 0; for (void *&Ptr : Ptrs) { - Ptr = Allocator->allocate(8192, scudo::Chunk::Origin::Malloc); + Ptr = Allocator->allocate(1 << SizeLog2, scudo::Chunk::Origin::Malloc); auto *Data = reinterpret_cast(Ptr); - for (size_t I = 0; I < 8192; I += PageSize) + for (size_t I = 0; I < 1 << SizeLog2; I += PageSize) Data[I] = 1; benchmark::DoNotOptimize(Ptr); + SizeLog2 = (SizeLog2 + 1) % 16; } for (void *&Ptr : Ptrs) Allocator->deallocate(Ptr, scudo::Chunk::Origin::Malloc);