Skip to content

Instance a FlutterViewController with initWithEngine and push from native page, after pop it the memory not released. How to release the engine? #25255

@Arnold134777

Description

@Arnold134777

Instance a FlutterViewController with initWithEngine and push from native page,
after pop it the memory not released. How to release the engine?

- (void)handleShowAction {
    if(_engine == nil) {
        _engine = [[FlutterEngine alloc] initWithName:@"io.flutter" 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;
}
[✓] 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: existing-appsIntegration with existing apps via the add-to-app flowc: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.waiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions