典型的android应用程序应使用多少内存? [英] How much memory should a typical android application use?

查看:96
本文介绍了典型的android应用程序应使用多少内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在android平台上开发了一个文件解析应用程序.如何检查我的应用程序实际消耗了多少内存?我尝试了adb shell cat/proc/meminfo命令,但这并没有给我我的应用程序正在使用多少内存.它只是提供有关整体内存的常规信息.应用程序通常应使用多少内存?什么是平常的还是不寻常的?任何帮助表示赞赏.谢谢!

I have developed a file parsing application on the android platform. How do I check how much memory my application is actually using up ? I tried the adb shell cat /proc/meminfo command but this does not give me how much memory my application is using. it just gives general info about the overall memory. And how much memory should an application typically use up ? what is usual or unusual ? Any help is appreciated. Thanks !

推荐答案

您可以使用DDMS>分配跟踪器来跟踪应用程序的内存使用情况和堆分配情况

You can use DDMS > Allocation Tracker to track memory usage and Heap Allocation for your app

http://developer.android.com/resources/articles/track- mem.html

要跟踪PID的总内存,可以在ActivityManager中使用以下两种方法

To Track the overall memory of a PID you could use following two methods in ActivityManager

要获取您的应用程序的PID:

To get a PID of your app :

List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses ()

,然后是MemoryInfo

and then the MemoryInfo

MemoryInfo[] getProcessMemoryInfo (int[] pids)

这篇关于典型的android应用程序应使用多少内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆