Out of memory error
Hello,
I was using flutter_scene to display a custom scene and after ~30 seconds (sometimes more) i encounter this error : (I tried running the example app with android enabled and i get the same issue in about the same time)
W/Adreno-GSL(19265): <sharedmem_gpuobj_alloc:2736>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(19265): <gsl_memory_alloc_pure:2604>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
E/Dart (19265): ../../../flutter/third_party/dart/runtime/vm/zone.cc: 96: error: Out of memory.
E/DartVM (19265): version=3.7.0-41.0.dev (dev) (Fri Oct 18 05:02:56 2024 -0700) on "android_arm64"
E/DartVM (19265): pid=19265, thread=501311792384, isolate_group=main(0xb4000073fdc91800), isolate=(nil)(0x0)
E/DartVM (19265): os=android, arch=arm64, comp=yes, sim=no
E/DartVM (19265): isolate_instructions=73956713a0, vm_instructions=73956713a0
E/DartVM (19265): fp=7fed0a7070, sp=7fed0a5f30, pc=739547f4a0
E/DartVM (19265): pc 0x000000739547f4a0 fp 0x0000007fed0a7070 /data/app/~~WKWWfwp-kVBfEnfLqqDjjA==/com.example.example_app-NkeMSxABHh3tXbyljYq4hA==/lib/arm64/libflutter.so+0x226f4a0
E/DartVM (19265): -- End of DumpStackTrace
E/DartVM (19265): pc 0x0000000000000000 fp 0x0000007fed0a8ce8 sp 0x0000000000000000 [Stub] CallToRuntime
E/DartVM (19265): pc 0x000000738e9834d0 fp 0x0000007fed0a8d18 sp 0x0000007fed0a8cf8 [Stub] LazyCompile
E/DartVM (19265): pc 0x0000007346630a3c fp 0x0000007fed0a8d68 sp 0x0000007fed0a8d28 [Unoptimized] [email protected]
E/DartVM (19265): pc 0x000000734662ee48 fp 0x0000007fed0a8df8 sp 0x0000007fed0a8d78 [Unoptimized] StackFrame.fromStackTraceLine
E/DartVM (19265): pc 0x000000734662eaa4 fp 0x0000007fed0a8e28 sp 0x0000007fed0a8e08 [Unoptimized] StackFrame.fromStackTraceLine
E/Dart (19265): ../../../flutter/third_party/dart/runtime/vm/zone.cc: 96: error: Out of memory.
E/DartVM (19265): Aborting reentrant request for stack trace.
F/libc (19265): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 19265 (ple.example_app), pid 19265 (ple.example_app)
...
I used the devtools to help me understand and this is what i see :
The orange dotted line is the RSS.
Thank you for your help
I'm having the same memory problem.
Reported an error out of memory on a Samsung phone.
The same flash back on the Honor phone, but only the log of the call keyboard will be output, and the following is the log of the Honor phone.
W/InputMethodManager( 7053): startInputReason = 8 W/HwRemoteInputMethodManager( 7053): isCasting false because IHwDistributedWindowManager is invalid. W/InputMethodManager( 7053): startInputReason = 7 W/HwRemoteInputMethodManager( 7053): isCasting false because IHwDistributedWindowManager is invalid.
Thanks for the report. This was likely caused by the HostBuffer leaking memory. I recently rewrote the HostBuffer implementation in Flutter GPU and changed Scene to use it properly, so this will hopefully be fixed with the next pub push.
Hi, i tried to use the 0.7.0-0 version of flutter_scene but still encounter the same error, i ran the examples provided and let the rotating car and in about 7-9 minutes the same crash appeared. I ran it on a real android device (OnePlus 7Pro). If you need more information i would happy to help. Thank you
the similar bugs in release mode:
[ +7 ms] I/flutter (28140): time 77.142
[ +10 ms] E/flutter (28140): [ERROR:flutter/impeller/renderer/backend/vulkan/allocator_vk.cc(528)] Impeller validation: Unable to allocate a device buffer: ErrorOutOfDeviceMemory
[ ] E/flutter (28140): [ERROR:flutter/lib/gpu/device_buffer.cc(62)] Failed to create device buffer.
[ ] I/flutter (28140): Exception: Failed to allocate DeviceBuffer of length 1024000
[ +1 ms] I/flutter (28140): Out of Memory
[ ] I/flutter (28140): Out of Memory
[ ] I/flutter (28140): Out of Memory
[ ] E/flutter (28140): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Out of Memory
[ ] E/flutter (28140): #0 _RegExp._ExecuteMatch (dart:core-patch/regexp_patch.dart)
[ ] E/flutter (28140): #1 _RegExp.firstMatch (dart:core-patch/regexp_patch.dart)
[ ] E/flutter (28140): #2 StackFrame.fromStackTraceLine (package:flutter/src/foundation/stack_frame.dart)
[ ] E/flutter (28140): #3 MappedIterator.moveNext (dart:_internal/iterable.dart)
[ ] E/flutter (28140): #4 WhereTypeIterator.moveNext (dart:_internal/iterable.dart)
[ ] E/flutter (28140): #5 new _GrowableList._ofOther (dart:core-patch/growable_array.dart)
[ ] E/flutter (28140): #6 new _GrowableList.of (dart:core-patch/growable_array.dart)
[ ] E/flutter (28140): #7 StackFrame.fromStackString (package:flutter/src/foundation/stack_frame.dart)
[ ] E/flutter (28140): #8 FlutterError.defaultStackFilter (package:flutter/src/foundation/assertions.dart)
[ ] E/flutter (28140): #9 debugPrintStack (package:flutter/src/foundation/assertions.dart)
[ ] E/flutter (28140): #10 FlutterError.dumpErrorToConsole (package:flutter/src/foundation/assertions.dart)
[ ] E/flutter (28140): #11 FlutterError.reportError (package:flutter/src/foundation/assertions.dart)
[ ] E/flutter (28140): #12 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart)
[ ] E/flutter (28140): #13 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart)
[ ] E/flutter (28140): #14 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart)
[ ] E/flutter (28140): #15 _invoke (dart:ui/hooks.dart)
[ ] E/flutter (28140): #16 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart)
[ ] E/flutter (28140): #17 _drawFrame (dart:ui/hooks.dart)
[ ] E/flutter (28140): #18 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart)
[ ] E/flutter (28140): #19 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart)
[ ] E/flutter (28140): #20 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart)
[ ] E/flutter (28140): #21 _invoke (dart:ui/hooks.dart)
[ ] E/flutter (28140): #22 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart)
[ ] E/flutter (28140): #23 _drawFrame (dart:ui/hooks.dart)
[ ] E/flutter (28140): #24 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart)
[ ] E/flutter (28140): #25 _drawFrame (dart:ui/hooks.dart)
[ ] E/flutter (28140): #26 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart)
[ ] E/flutter (28140): #27 _drawFrame (dart:ui/hooks.dart)
[ ] E/flutter (28140):
in debug mode:
[ +4 ms] W/Adreno-GSL(16500): <sharedmem_gpuobj_alloc:3516>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
[ ] E/Adreno-GSL(16500): <gsl_memory_alloc_pure_64:3038>: ERROR: kgsl_sharedmem_alloc() failed! Allocation size: (16 KB); Flags: (0x890c2500)
same error appeared on Samsung Fold 4 with flutter_app in examples
We have a similar memory leak on Vulkan on a flutter_gpu app (without flutter_scene). Reported in https://github.com/flutter/flutter/issues/164278