Commit aeb4ecf8 authored by Mark Santaniello's avatar Mark Santaniello Committed by Facebook GitHub Bot

Simplify Arena destructor

Summary: Use the intrusive list's clear_and_dispose API to simplify things somewhat.

Reviewed By: yfeldblum

Differential Revision: D22199152

fbshipit-source-id: fb6ec4e206660bc7628ddd87edba3698d8a2af6d
parent 4485ef0c
...@@ -87,10 +87,7 @@ void Arena<Alloc>::merge(Arena<Alloc>&& other) { ...@@ -87,10 +87,7 @@ void Arena<Alloc>::merge(Arena<Alloc>&& other) {
template <class Alloc> template <class Alloc>
Arena<Alloc>::~Arena() { Arena<Alloc>::~Arena() {
auto disposer = [this](Block* b) { b->deallocate(this->alloc()); }; blocks_.clear_and_dispose([this](Block* b) { b->deallocate(this->alloc()); });
while (!blocks_.empty()) {
blocks_.pop_front_and_dispose(disposer);
}
} }
} // namespace folly } // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment