Do not terminate the process to clear the memory.

Source: Internet
Author: User

It is inappropriate to terminate the process to clear the memory for the following reasons:

1. Android has its own process and memory management mechanism. Its Design Specification is to ensure that the program can be started as quickly as possible, which requires that the program still occupies the memory to save data after exiting;

2. the memory management policy of Android ensures that there is sufficient memory for loading new programs. When the memory is insufficient, low-priority processes will be disabled to release the memory;

3. process data is cached in the memory for a long time. It is not a defect for Android, but an advantage. It tries its best to ensure the startup quality of the program to improve the user experience. People are suffering from obsessive-compulsive disorder for a long time, I always mistakenly think that a large amount of memory is inefficient, which is unrelated to the long-term use of desktop systems;

4. Another misunderstanding is that memory consumption is not enough! The driver behind the scenes for real power consumption is the CPU. Repeated memory cleaning requires the CPU to work repeatedly, so cleaning the memory consumes power instead;


An image analogy on the Internet: If you look up information in the library, one solution is to take all the required information from the shelf and put it on the table. There may be redundancy, but you don't have to go to the bookshelves frequently to get books. Another solution is to put only the information you are currently reading on the desk and put it back on the shelf after checking the information. Although the desk is clean, but you need to read books from the shelves repeatedly. The book here is like memory, and the reading and writing operations are like CPU work. Obviously, the first solution is more efficient and easy.


Some reliable information:

Explain why the process does not need to be terminated to release memory


Suggestions from two Google engineers:

Romain GUY: the user should not terminate the process to release the memory, which is contrary to the Android Application Design framework and should be handed over to the system (here the user refers to the user who uses the app, it also refers to the app itself or app developers)! Topic/Android-developers/g_d3pknglt0


Dianne hackborn: strongly opposed to using system. Exit () to terminate the program, please do not design your Android app so much! Topic/Android-developers/y96knn_6rqm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.