zhangmingCSDN

Hello,编程

记深入分析优化Android应用系统的点点滴滴

Memory management for different virtual machines

Android Monitor uses the Virtual Machine (VM) that the device or emulator uses:

  • Android 4.3 (API level 18) and lower uses the Dalvik VM.
  • In Android 4.4 (API level 19), the Android RunTime (ART) VM is an option, while the Dalvik VM is the default.
  • Android 5.0 (API level 21) and higher uses the ART VM.

The VM handles garbage collection. The Dalvik VM uses a mark-and-sweep scheme for garbage collection. The ART VM uses a generational scheme, combined with mark-and-sweep when memory needs a more thorough garbage collection, such as when memory becomes excessively fragmented. The logcat Monitor displays some messages that indicate the type of garbage collection that occurred and why.

Memory Monitor results can vary between the different VMs. As a result, if you’re supporting both VMs, you might want to test with both. In addition, the VMs available for different API levels can have different behavior. For example, the Dalvik VM in Android 2.3 (API level 10) and lower uses externally allocated memory while higher versions allocate in the Dalvik heap only.

You can’t reconfigure the Dalvik and ART VMs to tune performance. Instead, you should examine your app code to determine how to improve its operation, for example, reducing the size of very large arrays.

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。联系邮箱:changhetcgroup@qq.com,来信注明编程技术交流 https://blog.csdn.net/zhangbuzhangbu/article/details/52381404
文章标签: android应用 优化
个人分类: 编程这些年
上一篇MAC下使用终端配置gradle环境变量
下一篇不同屏幕尺寸时获取drawable图片资源的真实尺寸
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭