Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

APP special-memory leak

Shulou Source: shulou.com Published: 2022-06-03 08:04:38 11月23日 Update

How to view the memory consumed by APP

System setting-- Storage-- Application-- running-- some APP

Adb shell dumpsys meminfo package name, but cannot be viewed in real time

DDMS, can be viewed in real time

Note:

Each APP occupies memory, including private (PrivateDirty) and public (ShareDirty) parts.

The running APP shown in the phone's system settings shows Total Pss (PSS: physical memory actually used)

Steps:

Adb shell dumpsys meminfo com.yibasan.lizhifm

Android program memory is divided into two parts: native and dalvikdalvik are what we usually call the java heap, and the objects we create are allocated to view pss total and heap size (27716KB).

Cannot exceed the maximum limit (use the following command to view)

Adb shell

Getprop | grep heapgrowthlimit

View the maximum memory limit of a single application (the maximum 27716KB of dalvik heap size in meminfo

If it exceeds 192 M, then OOM is likely to occur)

Summary:

After each gc, there is no significant decline in pss total, there may be a memory leak, but it still needs to be observed for a long time.

OOM occurs when dalvik heap size exceeds heapgrowthlimit

But if android:largeHeap=True is declared in the application tag in Manifest

Then OOM will not appear when dalvik heap reaches the heapgrowthlimit limit.

OOM will not appear until heap size is reached.

Adb shell

Getprop | grep dalvik.vm.heapsize maximum memory limit of a single java virtual machine

To sum up again:

The amount of memory initially allocated by dalvik.vm.heapstartsize-

Maximum memory limit for dalvik.vm.heapgrowthlimit- applications

Maximum memory limit of dalvik.vm.heapsize-java virtual machine

Tags: Memory maximum limit application single real-time time current program system part allocation run normal obvious again command comment size actual Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Shulou Technology OPPO Reno Microsoft