Android gain memory remaining size and total size

Source: Internet
Author: User

Method One:

How to view the memory limits of Android to apps

Each phone has a different limit on the app, and after all, we can use the following methods to see the maximum memory available to individual apps:

Execute command:

Shell Code
    1. ADB Shell Getprop | grep heap
    2. [Dalvik.vm.heapgrowthlimit]: [64m]
    3. [Dalvik.vm.heapsize]: [256m]
    4. [Dalvik.vm.heapstartsize]: [8m]

After entering the command, we look back to the above results.

[Dalvik.vm.heapstartsize]: [8m]: The starting heap=8m assigned to the process

[Dalvik.vm.heapgrowthlimit]: [64m]: Process can be assigned to a maximum of 64m

[Dalvik.vm.heapsize]: [256m]: The maximum amount of memory a single virtual machine can allocate =256m

Changing the above parameters can be modified in Build.prop

Build.prop in system, pull out to modify and then push back, reboot can

Reference:

http://su1216.iteye.com/blog/1663683

Method Two:

Execute while the program is running:

Java code
    1. int maxmemory = (int) (Runtime.getruntime (). MaxMemory ()/ 1024);
    2. LOG.D ("TAG", "Max memory is" + MaxMemory + "KB");

Divided by 1024 to get MB units, generally in 4.0 words are 64MB.

Android gain memory remaining size and total size

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.