4. Dynamic Array: array Granularity

Source: Internet
Author: User

 

*The size of a dynamic array is the number of elements that can be carried by the buffer space allocated to the array.

*If the array capacity has reached the maximum, the array will automatically allocate heap space to expand the capacity when new elements are added.

*The extended capacity is determined by the array granularity, which is specified during construction.

*All dynamic arrays, even or segmented buffers, have array granularity attributes.

*The selection of array granularity is very important.

 - The granularity is too small. When a large number of elements are added to the array, frequent allocation will occur, resulting in more system overhead.

 - The granularity is too large. When the added element is small, the storage space may be wasted.

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.