diff --git a/engine/src/flutter/runtime/dart_vm_lifecycle.cc b/engine/src/flutter/runtime/dart_vm_lifecycle.cc index ba6debf5d4..fc0721a30a 100644 --- a/engine/src/flutter/runtime/dart_vm_lifecycle.cc +++ b/engine/src/flutter/runtime/dart_vm_lifecycle.cc @@ -50,6 +50,14 @@ DartVMRef DartVMRef::Create(Settings settings, fml::RefPtr shared_snapshot) { std::lock_guard lifecycle_lock(gVMMutex); + if (!settings.leak_vm) { + FML_CHECK(!gVMLeak) + << "Launch settings indicated that the VM should shut down in the " + "process when done but a previous launch asked the VM to leak in " + "the same process. For proper VM shutdown, all VM launches must " + "indicate that they should shut down when done."; + } + // If there is already a running VM in the process, grab a strong reference to // it. if (auto vm = gVM.lock()) {