How can I find out how much heap memory I have at any moment?

I have a process that continues to die in the same place and is said to run out of memory, but I have a hidden suspicion that it is a red herring and that I eat the memory that it needs elsewhere. I'm curious what my options are for viewing the memory used and released in real time. Does ADB have a monitor of some kind that I can observe?

TIA

+4
source share
2 answers

I found the adb shell dumpsys meminfo ' command line name of your application package . If you want to view information about all processes, use adb shell dumpsys meminfo . It is probably worth it to output the output to a text file, since there is a lot of form data:

** MEMINFO in pid 5527 [com.sec.android.widgetapp.weatherclock] ** native dalvik other total size: 2868 5767 N/A 8635 allocated: 2861 2891 N/A 5752 free: 6 2876 N/A 2882 (Pss): 532 80 2479 3091 (shared dirty): 932 2004 6060 8996 (priv dirty): 512 36 1872 2420 Objects Views: 0 ViewRoots: 0 AppContexts: 0 Activities: 0 Assets: 3 AssetManagers: 3 Local Binders: 2 Proxy Binders: 8 Death Recipients: 0 OpenSSL Sockets: 0 SQL heap: 0 MEMORY_USED: 0 PAGECACHE_OVERFLOW: 0 MALLOC_SIZE: 0 

which returns from a real device connected via a USB port

+4
source

I use the DDMS perspective in Eclipse, which has a Heap tab for such monitoring. I'm not sure if there are command line alternatives for consumption by other IDEs.

+1
source

Source: https://habr.com/ru/post/1392922/


All Articles