Memory leakage is also known as "Storage leakage". The space dynamically opened by the dynamic storage allocation function is not released after use. As a result, this memory unit remains occupied. UntilProgramEnd. Memory leakage.
Memory leakage simply means that a piece of memory space is applied for and is not released after use. Generally, the longer the program runs, the more memory it occupies, and the entire system crashes. A piece of memory applied by the program, and no pointer points to it, the memory will be leaked.
From the perspective of user programs, memory leakage does not cause any harm. As a general user, the memory leakage does not exist. The real danger is the accumulation of Memory leakage, which will eventually consume all the memory of the system. From this point of view, one-time memory leakage is not harmful because it will not accumulate, while implicit memory leakage is very harmful, because it is more difficult to detect than frequent and occasional memory leaks.
Memory leakage of Android applications is caused by the following reasons:
1. The cursor is not closed after the database is queried.
2. convertview is not used to create an adapter.
3. Call recycle () to release the memory when the bitmap object is not in use.
4. objects are referenced by objects with a long life cycle. If an activity is referenced by a static set, the activity cannot be released.
Memory leakage detection:
Use the heap tool in ddms to detect memory overflow.
How to solve Memory leakage:
Use the memory analysis tool MAT (memory analyzer tool) to find Memory leakage objects.