Index: runtime/vm/service.cc |
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
index 4c49fcf8df692581aed6045eeb94ada6a49f4fc5..85167d122c90c2257a199324386a837f9b2ebf48 100644 |
--- a/runtime/vm/service.cc |
+++ b/runtime/vm/service.cc |
@@ -3477,6 +3477,18 @@ static const MethodParameter* get_heap_map_params[] = { |
static bool GetHeapMap(Thread* thread, JSONStream* js) { |
Isolate* isolate = thread->isolate(); |
+ bool should_collect = false; |
+ if (js->HasParam("gc")) { |
+ if (js->ParamIs("gc", "full")) { |
+ should_collect = true; |
+ } else { |
+ PrintInvalidParamError(js, "gc"); |
+ return true; |
+ } |
+ } |
+ if (should_collect) { |
+ isolate->heap()->CollectAllGarbage(); |
+ } |
isolate->heap()->PrintHeapMapToJSONStream(isolate, js); |
return true; |
} |