Repository navigation
fix: correct iOS lowMemory to real memory pressure, bump to 1.14.1 - #112
Merged
Merged
Conversation
- iOS getProcessMemoryInfo now reports system memory pressure via a DispatchSource memory-pressure monitor for the lowMemory field, instead of ProcessInfo.isLowPowerModeEnabled (Low Power / low-battery mode), matching Android/OHOS semantics. - Bump version 1.14.0 -> 1.14.1 (pubspec, podspec, inspector_version, README, example lock).
Replace unavailable DispatchSourceMemoryPressure.memoryPressureFlags with source.data (raw memory-pressure event flags), which is available across toolchains. Behavior unchanged: CRITICAL sets lowMemory true, NORMAL sets it false.
source.data returns DispatchSource.MemoryPressureEvent in this toolchain (memoryPressureFlags is unavailable); use flags.contains(.critical/.normal) directly. Restores correct low-memory detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
Fixes an iOS semantic bug where
getProcessMemoryInfo'slowMemoryfield reportedProcessInfo.isLowPowerModeEnabled(Low Power / low-battery mode) instead of the actual low-memory state, mismatching Android/OHOS; also bumps the package to 1.14.1.修复 iOS 语义 bug:
getProcessMemoryInfo的lowMemory字段此前返回isLowPowerModeEnabled(低电量 / 省电模式)而非真实低内存状态,与 Android / OHOS 不符;同时将包版本升至 1.14.1。Changes / 变更
getProcessMemoryInfonow reports real system memory pressure via aDispatchSourcememory-pressure monitor (CRITICAL→true /NORMAL→false) for thelowMemoryfield, replacing the incorrectisLowPowerModeEnabled(Low Power Mode)./ iOS
getProcessMemoryInfo的lowMemory字段现改用DispatchSource内存压力监听返回真实系统内存压力,取代错误的isLowPowerModeEnabled(低电量模式)。pubspec.yaml,ios/zero_inspector_kit.podspec,lib/src/utils/inspector_version.dart,README.md,README_zh.md, andexample/pubspec.lock./ 在
pubspec.yaml、iOS podspec、inspector_version.dart、中英文 README 及example/pubspec.lock中将版本由 1.14.0 升到 1.14.1。## 1.14.1CHANGELOG entry and updated the "Upgrade recommended" callouts in both READMEs to describe this fix./ 新增
## 1.14.1变更日志条目,并更新中英文 README 的"推荐升级"提示,简述本次修复。Context / 背景
On iOS there is no public API to query a boolean "is low memory" state, so the original code reused
isLowPowerModeEnabledas a proxy — conflating battery saver mode with memory pressure. ThelowMemoryfield already means "low memory state" on other platforms (Android uses real memory pressure), so the iOS value was misleading. This wires up the properDispatchSourcememory-pressure signal.iOS 没有公开 API 能直接查询"是否处于低内存状态"的布尔值,原代码误用
isLowPowerModeEnabled作为代理,把省电模式与内存压力混为一谈。lowMemory字段在其它平台(Android 使用真实内存压力)本就表示"低内存状态",因此 iOS 原返回值有误导。本次接入正确的DispatchSource内存压力信号。Checklist / 检查项
Test plan
flutter test test/version_consistency_test.dartpasses (all 5 checks green) /flutter test test/version_consistency_test.dart通过(5 项全绿)getProcessMemoryInfo()['lowMemory']reflects the pressure state and no longer mirrors Low Power Mode / 在 iOS 真机 / 模拟器上施加内存压力时,getProcessMemoryInfo()['lowMemory']应反映内存压力状态,不再与低电量模式同步🤖 Generated with Zero Buddy