-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Anroid 5 ~ 7 虚拟机堆内存减半方案存在的BUG #850
base: master
Are you sure you want to change the base?
Conversation
chengjian.scj seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
…e or space2Size always smaller than "dalvik.vm.heapsize"‘s value
Android 6级以上 "dalvik.vm.heapsize" property值不大于(大多数都为小于)虚拟机堆内存大小。 |
实际测试得出的结论: Android 6.0 SONY F3111型号 Android 7.0 XIAOMI MIX型号 |
理解你的意思了,应该是前面的表述说反了,实际是单个space的虚拟内存占用不大于dalvik.vm.heapsize。这个确实是art的设计,对于非largeHeap的App,启动时会通过Heap::ClampGrowthLimit缩减虚拟内存到growth_limit_,只是一般大型App都开了largeHeap。 |
🙏提醒,已更正 |
dev分支编译不过,直接在master分支操作了。
(1)Android 5.x space name相同
https://cs.android.com/android/platform/superproject/+/android-5.0.0_r1.0.1:art/runtime/gc/heap.cc
https://cs.android.com/android/platform/superproject/+/android-5.1.1_r9:art/runtime/gc/heap.cc
从上可以看出:
Android 5.x 系列Android系统存在一个BUG,即From和To的space name都是dalvik-main space(Android 5以上To的space name为dalvik-main space 1),因此Android 5.x 需要特殊处理。
(2)"dalvik.vm.heapsize" property值
Android 5.x 单个space的虚拟内存等于dalvik.vm.heapsize。
Android 6以上 单个space的虚拟内存不大于dalvik.vm.heapsize。
(3)IterateMaps存在fd泄漏
(4)ScopedCleaner移动构造函数内"omit"拼写错误
(5)IterateMaps中sscanf使用错误
s要求the terminating NUL character,如果使用s,则至少是4+1大小。
c不要求the terminating NUL character,如果使用c,则至少是4大小。
(6) pathLen是size_t类型,一定>=0,但会进行[pathLen-1]数组下标访问,pathLen必须>0
(7)适配 Android 5.0 TCL P590L机型
通常From和To在maps中为4条
//From
start:0x12c00000 end:0x12e01000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x12e01000 end:0x22c00000 path:/dev/ashmem/dalvik-main space (deleted)
//To
start:0x22c00000 end:0x22c01000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x22c01000 end:0x32c00000 path:/dev/ashmem/dalvik-main space (deleted)
Android 5.0 TCL P590L机型为5条
//From
start:0x12c00000 end:0x12c71000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x12c71000 end:0x12e71000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x12e71000 end:0x1bc00000 path:/dev/ashmem/dalvik-main space (deleted)
//To
start:0x1bc00000 end:0x1bc01000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x1bc01000 end:0x24c00000 path:/dev/ashmem/dalvik-main space (deleted)
假设还可能存在下列情况:
//From
start:0x12c00000 end:0x12c01000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x12c01000 end:0x1bc00000 path:/dev/ashmem/dalvik-main space (deleted)
//To
start:0x1bc00000 end:0x1bc71000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x1bc71000 end:0x1be71000 path:/dev/ashmem/dalvik-main space (deleted)
start:0x1be71000 end:0x24c00000 path:/dev/ashmem/dalvik-main space (deleted)
“Adptor for Android 5.0 TCL P590L” commit做了相关BUG修复。
验证机型
Android5.0
SAMSUNG SM-N9005
SAMSUNG SM-N9000Q
SAMSUNG SM-T807V
LGE LG-H422
MOTOROLA XT1078
Android5.1
SAMSUNG SM-A510M
SAMSUNG SM-G928F
SAMSUNG SM-J111F
OPPO A37f
BLACKBERRY STV100-1
Android6.0
VIVO Y67A
MEIZU MEIZU_M5
SONY F3311
HUAWEI VNS-AL00
XIAOMI Redmi Note 3
SAMSUNG SM-G930F
SAMSUNG SM-A700F
Android7.0
XIAOMI MIX
SAMSUNG SM-G955U
HUAWEI VKY-L09
HTC 10
MOTOROLA Moto G (4)
SONY F8331
OUKITEL C8
WHEATEK KIICAA POWER
Android7.1
ONEPLUS A5010
SONY G8141
XIAOMI Redmi 5
SAMSUNG SM-A730F
OPPO CPH1727
MEIZU MX6
LGE LG-M700