Skip to content

Displaying multiple large GIFs causes out of memory exception  #14344

@pcomans

Description

@pcomans

Steps to Reproduce

I am encountering a reproducible crash when displaying two 16MB GIFs in a list.
At first they all display correctly, then the app starts to flicker and ultimately terminates. This happens on iOS and Android.

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new SingleChildScrollView(
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Image.network("https://storage.googleapis.com/flutter-test/resized1.gif"),
            new Image.network("https://storage.googleapis.com/flutter-test/resized2.gif"),
//            new Image.network("https://storage.googleapis.com/flutter-test/resized3.gif"),
//            new Image.network("https://storage.googleapis.com/flutter-test/resized4.gif"),
          ],
        ),
      ),
    );
  }
}

Logs

Launching lib/main.dart on Moto G 5 Plus in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk (24.6MB).
Installing build/app/outputs/apk/app.apk...
I/flutter ( 2613): [WARNING] app lifecycle state changed: AppLifecycleState.paused
I/FlutterActivityDelegate( 7464): onResume setting current activity to this
Syncing files to device Moto G 5 Plus...
I/Choreographer( 7464): Skipped 217 frames!  The application may be doing too much work on its main thread.
W/Adreno-GSL( 7464): <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL( 7464): <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.

[☝️ This error is repeated 2193 times]

E/DartVM  ( 7464): ../../third_party/dart/runtime/vm/scavenger.cc: 411: error: Out of memory.
E/DartVM  ( 7464): Dumping native stack trace for thread 1f2c
E/DartVM  ( 7464):   [0x8f8aba65] Unknown symbol
E/DartVM  ( 7464):   [0x8f8aba65] Unknown symbol
E/DartVM  ( 7464): -- End of DumpStackTrace
F/libc    ( 7464): Fatal signal 6 (SIGABRT), code -6 in tid 7980 (ui_thread)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'motorola/potter_amz/potter:7.0/NPN25.137-83/87:user/release-keys'
Revision: 'p3b0'
ABI: 'arm'
pid: 7464, tid: 7980, name: ui_thread  >>> com.example.gifcrash <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    r0 00000000  r1 00001f2c  r2 00000006  r3 00000008
    r4 8967e978  r5 00000006  r6 8967e920  r7 0000010c
    r8 9f954400  r9 0001f5c0  sl 887057e4  fp 00400000
    ip 0000000c  sp 8967cf80  lr a854c3e7  pc a854ec44  cpsr 200e0010
backtrace:
    #00 pc 00049c44  /system/lib/libc.so (tgkill+12)
    #01 pc 000473e3  /system/lib/libc.so (pthread_kill+34)
    #02 pc 0001d535  /system/lib/libc.so (raise+10)
    #03 pc 00019081  /system/lib/libc.so (__libc_android_abort+34)
    #04 pc 000170e4  /system/lib/libc.so (abort+4)
    #05 pc 0017042b  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #06 pc 00706785  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #07 pc 00571cd5  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #08 pc 00572779  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #09 pc 0043cef5  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #10 pc 0043cd23  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #11 pc 0045d8db  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #12 pc 0045d6fd  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #13 pc 00596ed9  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #14 pc 00596e0d  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #15 pc 004e1f35  /data/app/com.example.gifcrash-2/lib/arm/libflutter.so
    #16 pc 00046eb3  /system/lib/libc.so (_ZL15__pthread_startPv+22)
    #17 pc 00019acd  /system/lib/libc.so (__start_thread+6)
Lost connection to device.

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.6 16G1036, locale en-US, channel alpha-chq)
    • Flutter version 0.0.21-pre.5 at /Users/philipp/code/flutter
    • Framework revision 389d91b6c4 (2 hours ago), 2018-01-29 15:12:37 -0800
    • Engine revision 6921873c71
    • Tools Dart version 2.0.0-dev.16.0
    • Engine Dart version 2.0.0-edge.da1f52592ef73fe3afa485385cb995b9aec0181a

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/philipp/Library/Android/sdk
    • Android NDK at /Users/philipp/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    • ios-deploy 1.9.2
    • CocoaPods version 1.4.0.beta.2

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2.6)
    • Flutter plugin version 20.0.2
    • Dart plugin version 172.4343.25

[✓] Connected devices
    • Moto G 5 Plus • ZY2242PN6T • android-arm • Android 7.0 (API 24)

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consoledependency: skiaSkia team may need to help usengineflutter/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