Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

APP special-memory leak

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report