11. Toad Notes Go language--memory splitter

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

11. Toad Notes Go language--memory splitter

Memory allocator, also known as Memoryallocator.

Core: Autonomous management, Cache reuse, no lock allocation.

Memory management takes the page as the basic unit, and multiple address contiguous pages form a block of memory.

Pages are page, and continuous pages are span.

Press 8 times times to divide small objects into various size specifications. Size class.

Three-tier management organization

The three-tier management bodies are shown in Figure 1:


The algorithm relies on successive addresses to reserve a larger address space. Figure 2below:

Saves the span pointer by page.

Checks to see if the object belongs to span.

Checks whether adjacent spans can be merged.

Quickly allocate and expand as needed.

Figure 3below:

Garbage collection

The garbage collector raises the recycle operation. Figure 4below:

Allocate memory for Management objects without occupying reserved addresses

Figure 5:

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.