Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Unified Diff: runtime/vm/thread.cc

Issue 2656263002: Fixed issue where initial 1KB zone buffer was not being accounted for when tracking thread zone mem… (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698