Android --- common causes of OOM

Table of contents

Out of memory OOM

The maximum memory available to a single application

Common causes of OOM

Memory real-time monitoring

Out of memory OOM

The maximum memory available to a single application

\bullet dalvik.vm.heapstartsize , which represents the initial size of the heap allocation.

\bullet dalvik.vm.heapgrowthlimit , which represents a single process memory limit.

\bullet dalvik.vm.heapsize , the maximum memory available to a single process.

When heapgrowthlimit is defined , its value is used to limit the memory value of a single process. Usually  the heapsize value will be greater than  the heapgrowthlimit value. When setting  the value of heapgrowthlimit is not enough, we can add   "android:largeHeap=true" in the manifest file (AndroidManifest.xml) file to use the value of heapsize.

Common causes of OOM

1. Load large images

2. Memory leak

java exception system

Memory real-time monitoring

JPDA

\bullet The Java platform debugging system JPDA (Java PlatformDebugger Architecture), which is a set of interfaces specially provided by the Java virtual machine for debugging and monitoring the virtual machine .

\bullet JVMTI is the interface exposed by the JVM, and JDI is the client that implements the JDWP communication protocol, through which the debugger communicates with the debugged program in the JVM.

 Important features of JVMTI

\bullet redefine class

\bullet Track object allocation and garbage collection process

\bullet Follow the object's reference tree and traverse all objects in the heap

\bullet Detect Java call stack

\bullet suspend (and resume) all threads

ART YOU

ART (Android Runtime). In Android 8.0 and higher, the ART Tool Interface (ART TI ) provides some runtime internal architectural information and allows splitters and debuggers to affect runtime behavior of apps, which can be used to achieve state-of-the-art performance tool .

Guess you like

Origin blog.csdn.net/qq_44950283/article/details/130145586