| Index: runtime/vm/thread.cc
|
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
|
| index 3ff121d7af1443efd7851151d3453df6ab1198cc..16091844b0ee92302c0885f62fb57482e5b61685 100644
|
| --- a/runtime/vm/thread.cc
|
| +++ b/runtime/vm/thread.cc
|
| @@ -38,8 +38,6 @@ Thread::~Thread() {
|
| delete compiler_stats_;
|
| compiler_stats_ = NULL;
|
| }
|
| - // All zone allocated memory should be free by this point.
|
| - ASSERT(current_thread_memory_ == 0);
|
| // There should be no top api scopes at this point.
|
| ASSERT(api_top_scope() == NULL);
|
| // Delete the resusable api scope if there is one.
|
| @@ -135,6 +133,19 @@ Thread::Thread(Isolate* isolate)
|
| compiler_stats_->EnableBenchmark();
|
| }
|
| }
|
| + // This thread should not yet own any zones. If it does, we need to make sure
|
| + // we've accounted for any memory it has already allocated.
|
| + if (zone_ == NULL) {
|
| + ASSERT(current_thread_memory_ == 0);
|
| + } else {
|
| + Zone* current = zone_;
|
| + uintptr_t total_zone_capacity = 0;
|
| + while (current != NULL) {
|
| + total_zone_capacity += static_cast<uintptr_t>(current->CapacityInBytes());
|
| + current = current->previous();
|
| + }
|
| + ASSERT(current_thread_memory_ == total_zone_capacity);
|
| + }
|
| }
|
|
|
|
|
|
|