Flutter run --release crash:抛出std :: bad_alloc实例后终止调用

时间:2019-03-06 06:45:20

标签: dart flutter

flutter运行--release失败,并显示以下信息:

Initializing gradle...                                              1.6s
Resolving dependencies...                                           2.1s
terminate called after throwing an instance of 'std::bad_alloc'         
  what():  std::bad_alloc                                               
Dart snapshot generator failed with exit code -6                        
Snapshotting exited with non-zero exit code: -6                         
Running Gradle task 'assembleProfile'...                                
Running Gradle task 'assembleProfile'... Done                      97.3s
Gradle task assembleProfile failed with exit code 1
mwpierce63@mwpierce63-HP-Z600-Workstation:~/Dropbox/Flutter/diet

flutter doctor -v输出:

[✓] Flutter (Channel beta, v1.2.1, on Linux, locale en_US.UTF-8)
    • Flutter version 1.2.1 at /home/mwpierce63/bin/flutter
    • Framework revision 8661d8aecd (3 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /home/mwpierce63/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /home/mwpierce63/bin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] Android Studio (version 3.1)
    • Android Studio at /home/mwpierce63/bin/android-studio
    • Flutter plugin version 29.1.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] IntelliJ IDEA Community Edition (version 2018.1)
    • IntelliJ at /home/mwpierce63/intelij/idea-IC-181.4668.68
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656

[✓] Connected device (3 available)
    • SM T320          • 08e8d4370683f6e6 • android-arm • Android 4.4.2 (API 19)
    • SAMSUNG SM N900A • 43fe4f65         • android-arm • Android 5.0 (API 21)
    • ASUS ZenFone 2E  • F8AZCY10U314     • android-x86 • Android 5.0.1 (API 21)

• No issues found!

flutter run --debug正常工作,flutter run --profile崩溃,出现上述相同错误。

有什么想法吗?

存在导致无限循环的令人讨厌的代码片段

          subObjs = recipeObjs.elementAt(idx).findElements('Serv');
//      the problem is here
      recipes.elementAt(idx).servings =
  int.tryParse(subObjs.elementAt(0).getAttribute("qty")) ?? 1;

0 个答案:

没有答案