Index: runtime/vm/dart_api_impl.cc |
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
index 038bfc85e64e7425fde0e191965309f23fc756ca..3ccb68b0504afae84d5d5113035bd7d482f0982d 100644 |
--- a/runtime/vm/dart_api_impl.cc |
+++ b/runtime/vm/dart_api_impl.cc |
@@ -1568,6 +1568,11 @@ static Dart_Handle createLibrarySnapshot(Dart_Handle library, |
} else { |
lib ^= Api::UnwrapHandle(library); |
} |
+ isolate->heap()->CollectAllGarbage(); |
+#if defined(DEBUG) |
+ FunctionVisitor check_canonical(isolate); |
+ isolate->heap()->IterateObjects(&check_canonical); |
+#endif // #if defined(DEBUG). |
ScriptSnapshotWriter writer(buffer, ApiReallocate); |
writer.WriteScriptSnapshot(lib); |
*size = writer.BytesWritten(); |