<p dir="auto">Instance a FlutterViewController with initWithEngine and push from native page,<br>
after pop it the memory not released. How to release the engine?</p>
<div class="highlight highlight-source-objc notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- (void)handleShowAction {
    if(_engine == nil) {
        _engine = [[FlutterEngine alloc] initWithName:@&quot;io.flutter&quot; project:nil];
        [_engine runWithEntrypoint:nil];
    }
    
    FlutterViewController *feedVC = [[FlutterViewController alloc] initWithEngine:_engine nibName:nil bundle:nil];
    [(UINavigationController *)self.window.rootViewController pushViewController:feedVC animated:YES];
}

- (void)handleDismissAction {
    [(UINavigationController *)self.window.rootViewController popViewControllerAnimated:YES];
    _engine = nil;
}"><pre class="notranslate">- (<span class="pl-k">void</span>)handleShowAction {
    <span class="pl-k">if</span>(_engine == <span class="pl-c1">nil</span>) {
        _engine = [[FlutterEngine <span class="pl-c1">alloc</span>] <span class="pl-c1">initWithName:</span><span class="pl-s"><span class="pl-pds">@"</span>io.flutter<span class="pl-pds">"</span></span> <span class="pl-c1">project:</span><span class="pl-c1">nil</span>];
        [_engine <span class="pl-c1">runWithEntrypoint:</span><span class="pl-c1">nil</span>];
    }
    
    FlutterViewController *feedVC = [[FlutterViewController <span class="pl-c1">alloc</span>] <span class="pl-c1">initWithEngine:</span>_engine <span class="pl-c1">nibName:</span><span class="pl-c1">nil</span> <span class="pl-c1">bundle:</span><span class="pl-c1">nil</span>];
    [(UINavigationController *)<span class="pl-c1">self</span>.window.rootViewController <span class="pl-c1">pushViewController:</span>feedVC <span class="pl-c1">animated:</span><span class="pl-c1">YES</span>];
}

- (<span class="pl-k">void</span>)handleDismissAction {
    [(UINavigationController *)<span class="pl-c1">self</span>.window.rootViewController <span class="pl-c1">popViewControllerAnimated:</span><span class="pl-c1">YES</span>];
    _engine = <span class="pl-c1">nil</span>;
}</pre></div>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[✓] Flutter (Channel faceu_dev_1.0.0, v1.0.1-pre.5, on Mac OS X 10.13.6 17G65,
    locale zh-Hans-CN)
    • Flutter version 1.0.1-pre.5 at
      /Users/arnold/Documents/study/flutter/flutter
    • Framework revision 0fd43583b8 (3 days ago), 2018-12-09 19:12:32 +0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.io/setup/#android-setup for detailed
      instructions).
      If Android SDK has been installed to a custom location, set $ANDROID_HOME
      to that location.
      You may also want to add it to your PATH environment variable.


[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[!] VS Code (version 1.29.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter"><pre class="notranslate"><code class="notranslate">[✓] Flutter (Channel faceu_dev_1.0.0, v1.0.1-pre.5, on Mac OS X 10.13.6 17G65,
    locale zh-Hans-CN)
    • Flutter version 1.0.1-pre.5 at
      /Users/arnold/Documents/study/flutter/flutter
    • Framework revision 0fd43583b8 (3 days ago), 2018-12-09 19:12:32 +0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.io/setup/#android-setup for detailed
      instructions).
      If Android SDK has been installed to a custom location, set $ANDROID_HOME
      to that location.
      You may also want to add it to your PATH environment variable.


[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[!] VS Code (version 1.29.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
</code></pre></div>
<p dir="auto">Initial experiments are showing that there's a significant bit of memory still in use after the activity that has a Flutter view has finished. E.g. we should be able to drop down to near 0 memory usage once there isn't any active Flutter views.</p>
<p dir="auto">The methodology of experiment and results are detailed in an internal document that was shared with Flutter team.</p>