java - Runime.getRuntime().totalMemory() 和 ActivityManager.MemoryInfo()
问题描述
为什么提取的总内存getRuntime().totalMemory()
与我们使用时不相等ActivityManager.MemoryInfo()
?在下面的两个代码部分中,我得到不同的值:
long totalMemory = Runtime.getRuntime().totalMemory() ;
和
ActivityManager actManager = (ActivityManager) getActivity().getSystemService(ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
actManager.getMemoryInfo(memInfo);
long totalMemory = memInfo.totalMem
在第一个代码中我得到 12.759.040 ,从第二个代码中我得到 907.034.624 !
解决方案
推荐阅读
- python - 将 Pymunk 与 matplotlib.animation.FuncAnimation() 一起使用
- java - 在 Java 中处理异步操作
- java - 在被覆盖之前保存特定数量值的集合
- javascript - 当我尝试显示对象的值时,为什么会出现“未定义”?
- python - 如何根据熊猫中的多列进行分组?
- css - 一旦你到达终点,CSS 可以让侧边栏粘到(底部)吗?
- python - spark函数中 approxCountDsitinct 和 approx_count_distinct 之间的区别
- python - 为什么此代码不会返回并将信息创建到 .csv 文件?
- django - 如何使用 django rest 框架获取每小时的客户数量
- python - 如何用一组值替换 SymPy 符号?