Skip to content

Use old_gen_heap_size to encourage the Dart VM to more aggressively collect garbage on mobile platforms #63631

@dnfield

Description

@dnfield

Since https://dart-review.googlesource.com/c/sdk/+/151635, this flag helps limit how much memory the VM will allocate in old space, and should help trigger collections more aggressively as we approach device limits.

On Android, this could be defaulted to dalvik.vm.heapsize, which is the size of a "largeHeap" app on Android. My only concern with this is that this value is likely much lower than what we currently allow - i.e. I haven't seen it larger than 512mb, whereas I've definitely run apps without OOMing that use multiple gigabytes of RAM.

On iOS, we should probably be safe with [NSProcessInfo processInfo].physicalMemory / 2. Some devices seem to let you use more (e.g. use up to 75% of memory before killing you), but some are as low as half.

  • Android
  • iOS
  • Fuchsia (TBD)

/cc @iskakaushik @gw280 for input on Fuchsia

/cc @rmacnak-google FYI

/cc @zanderso @liyuqian

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listdependency: fuchsiaFuchsia team may need to help usengineflutter/engine related. See also e: labels.perf: memoryPerformance issues related to memoryplatform-androidAndroid applications specificallyplatform-fuchsiaFuchsia code specificallyplatform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions