C + + STL Space Configurator (5)---"C + + STL" __c++

Source: Internet
Author: User

See more details: https://zcheng.ren/2016/08/16/STLAllocater/
In the implementation of STL, the Space Configurator is the most important one, because the whole STL operation object is placed in the container, how to allocate space for the container so that the container can store the data. At this time we need to configure the Alloc for processing.
What does the space Configurator alloc include?
The Space Configurator configures the memory. Release is separate from the construction and destructor release of the object, so the STL space Configurator consists of two parts to explain:
1. Construction and deconstruction of objects
For C + + built-in types and user-defined types we have to judge that they need not be destructor;
2, Memory application and release: More than 128b time to call the first-level configurator
To determine when applying for memory space if the request fails, a new configuration function is defined to recycle the space, configure the space, until the memory space is finally found or the memory space can not be requested to exit the loop; Call Level two configurator when less than 128b
Second-level Configurator is more fun, has its own memory pool and a corresponding free list, free list in their own free_list above the application of space, if you can not apply to the memory pool above the memory space application.

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.