开发者

trouble using Debug.MemoryInfo

I am trying to get memory usage values using this class, but all the class members are zero. I am calling it like this:

android.os.Debug.MemoryInfo dbm = new android.os.Debug.MemoryInfo(开发者_如何学Go);

but them dbm.dalvikPss (and the other class members) are zero. Any ideas? Thanks in advance.


You have to call Debug.getMemoryInfo() to populate it.

MemoryInfo dbm = new MemoryInfo();
Debug.getMemoryInfo(dbm);


You can also do it based on the getProcessMemoryInfo(pids[])

    int myPid = android.os.Process.myPid();
    int[] pids = {myPid};
    Debug.MemoryInfo[] memoryInfoPids = am.getProcessMemoryInfo (pids );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜