Skip to content
Snippets Groups Projects
Commit ff23f801 authored by Craig Tiller's avatar Craig Tiller
Browse files

Fix crash

parent 09acb108
No related branches found
No related tags found
No related merge requests found
......@@ -48,8 +48,15 @@ BENCHMARK(BM_Arena_NoOp)->Range(1, 1024 * 1024);
static void BM_Arena_ManyAlloc(benchmark::State& state) {
gpr_arena* a = gpr_arena_create(state.range(0));
const size_t realloc_after =
1024 * 1024 * 1024 / ((state.range(1) + 15) & 0xffffff0u);
while (state.KeepRunning()) {
gpr_arena_alloc(a, state.range(1));
// periodically recreate arena to avoid OOM
if (state.iterations() % realloc_after == 0) {
gpr_arena_destroy(a);
a = gpr_arena_create(state.range(0));
}
}
gpr_arena_destroy(a);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment