The Random-access memory (RAM) is one of the most valuable resources in any software development environment, but it's even more valuable in mobile environments where physical memory is constrained.

Retaining memory that the app doesn't need can cause out of memory (OOM) exceptions or constraints on the system's overall performance.

To maintain a functional multi-tasking environment, Android sets a fixed limit on the Dalvik heap size for each app. The exact Dalvik heap size limit varies across devices, based on how much RAM the device has available overall. If your app has reached the heap capacity and tries to allocate more memory, it will receive an OutOfMemoryError.

PSS Memory

PSS stands for Proportional Set Size and it is the total memory footprint of a process, calculated by the Android System. Considering that a process will always have a private amount of memory to use plus an extra amount of memory that is shared with other processes, PSS takes these into consideration to provide a fair quota of the app's memory usage.

PSS = private memory + (shared memory/amount of processes sharing it)

Dalvik Heap

The Dalvik Heap is the memory space handled by the Android System (Dalvik or ART). This will typically store all the app's objects that are created using the Android SDK.

Native Heap

The Native Heap is handled directly on the Android kernel and typically stores assets like bitmaps. Native memory handling depends on the frameworks your app uses and requires more caution when handling and releasing memory as there is no Garbage Collector.

GC Time

The Garbage Collector is a process that monitors objects that are no longer used by the app and frees up the Dalvik Heap. GC time is the amount of time that this process takes to complete. Excessive memory allocation in the app could lead to higher GC times.

To get more details on how to analyze the Memory usage of your app, click and expand the video below:

Did this answer your question?