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

Unified Diff: runtime/vm/thread_test.cc

Issue 2762323002: Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previo… (Closed)
Patch Set: Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previo… Created 3 years, 9 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/thread.cc ('k') | runtime/vm/zone.h » ('j') | runtime/vm/zone.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_test.cc
diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc
index 790596982a137901e5d30cdb0ee504d03dedde00..5c1e9ca9428e7a938c1182d87dea1dcc8300aa83 100644
--- a/runtime/vm/thread_test.cc
+++ b/runtime/vm/thread_test.cc
@@ -325,21 +325,33 @@ TEST_CASE(ManySimpleTasksWithZones) {
// Confirm all expected entries are in the JSON output.
for (intptr_t i = 0; i < kTaskCount + 1; i++) {
Thread* thread = threads[i];
+
+ // Skip checking the current thread since we'll be allocating
+ // thread_info_buf into the current thread's zone, messing with the test
+ // values.
+ if (thread == current_thread) {
+ continue;
+ }
siva 2017/03/22 17:50:55 How did the current_thread get into the threads ar
bkonyi 2017/03/22 18:01:48 Good catch. I guess when I originally wrote this t
+
StackZone stack_zone(current_thread);
Zone* current_zone = current_thread->zone();
// Check the thread exists and is the correct size.
- char* thread_info_buf =
- OS::SCreate(current_zone,
- "\"type\":\"_Thread\","
- "\"id\":\"threads\\/%" Pd
- "\","
- "\"kind\":\"%s\","
- "\"_memoryHighWatermark\":\"%" Pu "\"",
- OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()),
- Thread::TaskKindToCString(thread->task_kind()),
- thread->memory_high_watermark());
-
+ char* thread_info_buf = OS::SCreate(
+ current_zone,
+ "\"type\":\"_Thread\","
+ "\"id\":\"threads\\/%" Pd
+ "\","
+ "\"kind\":\"%s\","
+ "\"_zoneHighWatermark\":\"%" Pu
+ "\","
+ "\"_zoneCapacity\":\"%" Pu
+ "\","
+ "\"_zoneUsage\":\"%" Pu "\"",
+ OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()),
+ Thread::TaskKindToCString(thread->task_kind()),
+ thread->zone_high_watermark(), thread->current_zone_capacity(),
+ thread->current_zone_memory_usage());
EXPECT_SUBSTRING(thread_info_buf, json);
}
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/zone.h » ('j') | runtime/vm/zone.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698