What are gc_external_alloc freed and gc_explicit freed?

Source: Internet
Author: User

09-28 17:16:37. 543: Debug/dalvikvm (21466): gc_external_alloc freed 390 objects/45656 bytes in 50 ms
09-28 17:16:40. 513: Debug/dalvikvm (3267): gc_explicit freed 4501 objects/251624 bytes in 67 Ms

Many developers do not understand what the above sentence means. I 'd like to explain it to you!

The preceding free memory is the memory used by Java in the VM. External refers to the memory allocated by malloc in the native class in JNI, such as bitmap and some cursor.
In davilk, the memory allocated to a program varies with the model vendor. Most of the current memory is 32 MB, in the VM, the memory is divided into memory used by Java and memory used by native, which cannot be shared. That is to say, when your native memory is used up, now Java has idle memory, and Native will apply again like VM instead of using Java directly.
Example:
Free 3411 K/6663k and external 24870 K/26260 K
If you need to create a 2 m

Bitmap
Native's existing memory is 26260-24870 = 1390 k <2048 K, so he will apply for memory from the VM, although the Java idle memory is
6663-3411 = 3252> 2048, but this part of memory native is not available.
However, if you apply for 2 MB native memory, the VM will tell you that it cannot be allocated because the used memory is close to the peak of 32 MB (26260 + 6663 = 32923 ), therefore, force close reports oom.
So now we need to check the usage of our native memory to avoid oom.

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.