You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter v2.10.5/iPadOS下Exhausted heap space问题求助

Flutter v2.10.5/iPadOS内存耗尽崩溃(Android无异常,升级3.3.2仍复现)

环境信息

Doctor summary (to see all details, run flutter doctor -v):    
  [✓] Flutter (Channel stable, 2.10.5, on macOS 12.6 21G115 darwin-x64, locale en-GB)    
  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)    
  [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)    
  [✓] Android Studio (version 4.1)    
  [✓] VS Code (version 1.71.2)    
  [✓] Connected device (2 available)    
  [✓] HTTP Host Availability
• No issues found!

问题详情

在MacOS环境下使用Flutter v2.10.5开发,应用在iPadOS设备运行时频繁触发Exhausted heap space错误并崩溃,但Android端运行完全正常。已执行flutter clean操作,无效。因需求限制需保留v2.10.5版本不升级;测试Flutter 3.3.2版本时,应用崩溃时间更早,仍出现类似内存耗尽错误。

错误日志

基础内存耗尽提示

Exhausted heap space, trying to allocate 48 bytes.
Exhausted heap space, trying to allocate 32 bytes.
Exhausted heap space, trying to allocate 48 bytes.
Exhausted heap space, trying to allocate 32 bytes.
Exhausted heap space, trying to allocate 48 bytes.
Exhausted heap space, trying to allocate 32 bytes.
Exhausted heap space, trying to allocate 48 bytes.
Exhausted heap space, trying to allocate 32 bytes.
Exhausted heap space, trying to allocate 48 bytes.
Exhausted heap space, trying to allocate 32 bytes.

典型崩溃栈

Reloaded 1 of 2289 libraries in 3,398ms.
   * thread #10, name = 'io.flutter.1.ui', stop reason = EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=2867 MB, unused=0x0)`
    frame #0: 0x00000001036261e4 Flutter`dart::DebuggerStackTrace::CollectAsyncLazy() + 1072
Flutter`dart::DebuggerStackTrace::CollectAsyncLazy:
->  0x1036261e4 <+1072>: str    x0, [x24, #0x18]
    0x1036261e8 <+1076>: bl     0x103625900               ; dart::Code::ZoneHandle()
    0x1036261ec <+1080>: str    x0, [x24, #0x20]
    0x1036261f0 <+1084>: bl     0x103625934               ; dart::Function::ZoneHandle()
Target 0: (Runner) stopped.

2022/9/27更新:Flutter 3.3.2测试崩溃日志

Exhausted heap space, trying to allocate 80 bytes.
../../third_party/dart/runtime/vm/object.cc: 5722: error: expected: is_finalized()
version=2.18.1 (stable) (Tue Sep 13 11:42:55 2022 +0200) on "ios_arm64"
pid=5514, thread=43011, isolate_group=main(0x102077c00), isolate=main(0x102056c00)
isolate_instructions=103dee3c0, vm_instructions=103dee3c0
  pc 0x000000010474e830 fp 0x000000016f243f10 Dart_DumpNativeStackTrace+0x18
  pc 0x0000000104363830 fp 0x000000016f243f30 dart::Assert::Fail(char const*, ...) const+0x30
  pc 0x000000010445bb5c fp 0x000000016f243fc0 dart::Class::LookupFunctionReadLocked(dart::String const&, dart::Class::MemberKind) const+0x4b0
  pc 0x0000000104500990 fp 0x000000016f244090 dart::ResolveDynamicAnyArgsWithCustomLookup(dart::Zone*, dart::Class const&, dart::String const&, bool, std::__1::function<dart::FunctionPtr (dart::Class&, dart::String const&)>)+0x2e4
  pc 0x0000000104500570 fp 0x000000016f244120 dart::ResolveDynamicForReceiverClassWithCustomLookup(dart::Class const&, dart::String const&, dart::ArgumentsDescriptor const&, bool, std::__1::function<dart::FunctionPtr (dart::Class&, dart::String const&)>)+0xb8
  pc 0x000000010450f7b0 fp 0x000000016f244210 dart::PatchableCallHandler::ResolveSwitchAndReturn(dart::Object const&)+0x3f4
  pc 0x000000010450906c fp 0x000000016f2448f0 dart::DRT_SwitchableCallMiss(dart::NativeArguments)+0x404
  pc 0x000000010bd0295c fp 0x000000016f244930 Unknown symbol
  pc 0x000000010bd02fdc fp 0x000000016f244970 Unknown symbol
  pc 0x00000002c0f07e34 fp 0x000000016f2449a0 Unknown symbol
  pc 0x000000010bd02ed8 fp 0x000000016f244a70 Unknown symbol
  pc 0x00000001043b50b8 fp 0x000000016f244b10 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x25c
  pc 0x0000000104734154 fp 0x000000016f244bf0 Dart_ToString+0x1c4
  pc 0x0000000104350a30 fp 0x000000016f244d80 (anonymous namespace)::LogUnhandledException(_Dart_Handle*, _Dart_Handle*)+0x3c
  pc 0x00000001043509c4 fp 0x000000016f244dd0 (anonymous namespace)::ReportUnhandledException(_Dart_Handle*, _Dart_Handle*)+0xec
  pc 0x00000001041ddba0 fp 0x000000016f244e00 tonic::CheckAndHandleError(_Dart_Handle*)+0x48
  pc 0x00000001041db0bc fp 0x000000016f244e90 tonic::DartMicrotaskQueue::RunMicrotasks()+0xbc
  pc 0x00000001040db5b0 fp 0x000000016f244fd0 fml::MessageLoopImpl::FlushTasks(fml::FlushType)+0x7e8
  pc 0x00000001040def18 fp 0x000000016f244ff0 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*)+0x20
  pc 0x0000000180b77678 fp 0x000000016f245000 <redacted>+0x20
  pc 0x8e585c0180afb654 fp 0x000000016f2460d0 <redacted>+0x8e585c0000000428
  pc 0x8a56e98180af5e00 fp 0x000000016f246130 <redacted>+0x8a56e98000000140
  pc 0xc724bb0180ad44b0 fp 0x000000016f246e90 <redacted>+0xc724bb0000000790
  pc 0x7c27640180ae7bc8 fp 0x000000016f246f40 CFRunLoopRunSpecific+0x7c27640000000258
  pc 0x316a4701040dede8 fp 0x000000016f246f80 fml::MessageLoopDarwin::Run()+0x316a470000000058
  pc 0x00000001040dde68 fp 0x000000016f246fc0 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0> >(void*)+0xd0
  pc 0x00000001f0b359ac fp 0x000000016f246fe0 _pthread_start+0x94
-- End of DumpStackTrace
  pc 0x0000000000000000 fp 0x000000016f244930 sp 0x0000000000000000 [Stub] CallToRuntime
  pc 0x000000010bd02fdc fp 0x000000016f244970 sp 0x000000016f244940 [Stub] SwitchableCallMiss
  pc 0x00000002c0f07e34 fp 0x000000016f2449a0 sp 0x000000016f244980 [Unoptimized] _objectToString@0150898
  pc 0x000000010bd02ed8 fp 0x000000016f244a70 sp 0x000000016f2449b0 [Stub] InvokeDartCode
* thread #8, name = 'io.flutter.1.ui', stop reason = signal SIGABRT
    frame #0: 0x00000001b79d5b38 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1b79d5b38 <+8>:  b.lo   0x1b79d5b58               ; <+40>
    0x1b79d5b3c <+12>: pacibsp
    0x1b79d5b40 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b79d5b44 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Exited

已尝试操作

  • 执行flutter clean,无效
  • 测试升级至Flutter 3.3.2,崩溃更早,问题未解决

需要的话可提供更多信息。

内容的提问来源于stack exchange,提问作者Sword8

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 13:30:41