[vm] Fix memory leak if isolate group creation fails (e.g. because VM is shutting down)
[vm] Fix memory leak if isolate group creation fails (e.g. because VM is shutting down)

The leak can happen if isolate group creation is in-progress while the
main isolate group shuts down. This will disable isolate (group)
creation. Failure to create the isolate group will lead to the leak.

The issue can be reproduced by applying the following diff

    diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
    index 8993e5f3855..9335b5981d8 100644
    --- a/runtime/vm/isolate.cc
    +++ b/runtime/vm/isolate.cc
    @@ -1894,6 +1894,7 @@ Isolate* Isolate::InitIsolate(const char* name_prefix,
       }

       // Add to isolate list. Shutdown and delete the isolate on failure.
    +  sleep(1);
       if (!TryMarkIsolateReady(result)) {
         result->LowLevelShutdown();
         Isolate::LowLevelCleanup(result);

Fixes https://github.com/dart-lang/sdk/issues/41883

TEST=Verified this CL fixes the leak by applying the diff above.

Change-Id: Id64f6ebe88aafa589eecb7577464323a5a28cb20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206860
Reviewed-by: Tess Strickland <cce218d042444252b7ac446d60910fca7732559c@google.com>
Commit-Queue: Martin Kustermann <a35dd5b79fac84b2bb3b026a16b8becc55af5961@google.com>

dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk