EmuLabZip logo EmuLabZip

Memory

Last updated · Edit this page on GitHub

The Memory tool shows where the selected app's memory goes and lets you compare two moments to see what grew.

Snapshots#

Click Take snapshot to record a breakdown:

AndroidiOS Simulator
Sourcedumpsys meminfo <package>footprint --json <pid> on the Mac
TotalPSS (proportional set size)Footprint, the number iOS uses to decide when to terminate an app
CategoriesJava heap, native heap, code, stack, graphics, private other, systemVM regions such as MALLOC_SMALL, __DATA, CoreAnimation
DetailsTotal RSS, swap, and object counts (views, activities, binders, WebViews…)Clean and reclaimable memory, region count

Take a snapshot, use the app (open and close a screen a few times), then take another one. The second snapshot is compared with the previous one automatically; choose any other baseline from the Compared with menu. Categories are listed by the size of their change, with an arrow and a sign so the direction never depends on colour alone.

A category that keeps growing across repeated actions is a good place to look for a leak.

Heap dumps#

AndroidiOS Simulator
ButtonHeap dump…Memory graph…
File.hprof, written with am dumpheap.memgraph, written with leaks --outputGraph
Open it withAndroid Studio, Eclipse MAT, or PerfettoXcode (File › Open), leaks, heap, vmmap
RequirementA debuggable app (or an eng/userdebug image)None

On Android the dump is written to /data/local/tmp, copied to your computer and removed from the device.

EmuLabZip can also read the dump itself: Find leaks (or Open dump… for a file on disk) lists destroyed Activities and removed Fragments that are still alive, the path that keeps each one, and the objects that keep the most memory alive. See Finding leaks.

From the command line#

emulabzip mem com.example.app
emulabzip mem com.example.app --json
emulabzip heapdump com.example.app -o before-login.hprof
emulabzip heapdump com.example.app --analyze
emulabzip heap analyze before-login.hprof