Memory Testing for Android Client Performance

This article explains various Android memory testing techniques—including ActivityManager.MemoryInfo, adb commands, procrank, and DDMS/Mat tools—while describing usage intensity scenarios and how to interpret memory metrics to improve app stability and user experience.

Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Intelligent Testing
Memory Testing for Android Client Performance

Android client performance testing covers many dimensions such as memory, CPU, GPU, power consumption, network traffic, startup time, and smoothness; third‑party tools like Tencent GT and NetEase Emmagee use low‑level APIs, but they cannot accurately measure all aspects, so developers often combine them with hardware methods.

Memory testing is crucial because excessive memory usage can cause lag, crashes, and affect user retention; applications should keep memory usage low and release it promptly. Usage intensity is classified into three states: idle (app launched but not used), medium (user interacts for an uncertain but relatively long period), and high (frequent interactions, often simulated with monkey testing to detect memory leaks).

The article organizes common Android memory testing methods into four categories.

1. Using Android's ActivityManager.MemoryInfo() method

This API is employed by tools such as Emmagee and GT to retrieve an app's memory data; after installing the app, users select it in the tool to start testing and the results are saved on the device’s SD card.

2. Using Android ADB command set

1) Dump memory data

Command: adb shell dumpsys meminfo – shows memory consumption for all apps.

To view a specific app or process: adb shell dumpsys meminfo packagename or adb shell dumpsys meminfo pid.

These commands display Heap size details, including Native Heap and Dalvik Heap; exceeding Dalvik limits can cause OOM.

2) Check an app's maximum memory limit

Command: adb shell getprop | grep heapgrowthlimit 3) View an app's memory usage

Command examples: adb shell getprop|grep heapgrowthlimit, adb shell getprop|grep dalvik.vm.heapstartsize, adb shell getprop|grep dalvik.vm.heapsize.

When Dalvik heap exceeds heapgrowthlimit an OOM occurs; setting android:largeHeap="true" in the manifest raises the limit but OOM will still happen once heapsize is reached.

3. Using Android's procrank tool

Command: adb shell procrank | grep packagename – provides VSS, RSS, PSS, and USS values.

VSS ≥ RSS ≥ PSS ≥ USS; USS can only be obtained via procrank, which requires the libpagemap.so, procmem, and procrank binaries on the device.

4. Using ADT plugin DDMS and MAT analysis

DDMS’s Heap view lets developers inspect an app’s memory usage in real time; selecting an app under Devices and clicking “Update Heap” shows current allocation, and “Cause GC” forces garbage collection for a clearer view.

These methods together enable developers to obtain accurate memory metrics, detect leaks, and optimize Android applications for better performance and stability.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AndroidADBDDMSMemory TestingProcrank
Baidu Intelligent Testing
Written by

Baidu Intelligent Testing

Welcome to follow.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.