Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都知道什么是 Android 功能来获取我的应用程序分配的内存信息,如 DDMS 中所示?
它是黄色突出显示的值:
谢谢
所以我找到了正确的功能:
Runtime rt = Runtime.getRuntime(); long heapSize = rt.totalMemory(); long free = rt.freeMemory(); long allocated = heapSize - free;
这给出了 DDMS 报告的准确数字。
这是为了获取分配的内存 Debug.getNativeHeapAllocatedSize()