Android Memory Optimizer

Source: Internet
Author: User

Background

Although the Android device is getting more and more high, however, due to the mechanism of the Android system (mostly the main thread of the app will not actually exit but in the background resident memory)

, so that after installing too many apps in the phone, the memory is heavily occupied, and finally the memory for the system and application operations is reduced.

Therefore, in the development process, we need to pay special attention to memory optimization and release.

Summary of the General

A note

1 Java Four ways to reference, soft, weak reference ...
2 reduce unnecessary global variables, especially the context
3 Closing the Dispose resource object
For sqliteopenhelper,sqlitedatabase,cursor, files, I/O operations should be remembered to show off.
4 Avoid creating unnecessary objects
5 Cache
6 layout is faster than XML with Java code; View optimization
7 using a thread pool to handle complex, time-consuming operations

Two notation

8 Avoid using floating-point numbers, in Android devices, floating-point numbers are twice times slower than integers
9 using the static final modifier for constants
10 Avoid internal getters/setters, direct field access is about 3 times times faster than calling getter access
11 static methods instead of virtual methods
12 Avoid using enumerations, poor performance
13 replacing serialization serialization with Precelable
14 data compression, transmission

......

In the ps:android system, the memory allocated by each individual app is an integer multiple of 8, up to a maximum of 32MB.

Google launches Android performance optimization model

Http://www.oschina.net/news/60157/android-performance-patterns

Android Memory Optimizer

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: info-contact@alibabacloud.com 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.