6.4 Districts. doc

Source: Internet
Author: User

C Language Program after compiling the link to form a binary image file consists of stacks, heaps, data segments, code snippets, wherein the data segment is divided into: read-only data segment, has initialized the read and write data segments, uninitialized data segment (BSS). As shown in the following:

1. Stack: The compiler automatically allocates releases, stores the function's parameter values , and local variables are equivalent. It operates in a manner similar to a stack in a data structure.

2. heap: Usually released by the programmer, if the programmer does not release, it may cause memory leaks.

Note: 1) stacks and data structures are not the same stack, whose classes are linked lists.

2) The so-called memory leak refers to the program running in the memory of the less, if the program is finished, then the operating system will automatically release its occupied memory.

3. Program code area: the binary code that holds the function body , this part is only readable and not writable.

4. Data section:

1) Read-only data segments: read-only data segments are data that the program uses that are not changed and stored in read-only memory (along with the code area). It is generally a const-Modified variable and some literal constants used in the program .

2) initialized read-write data segment: A variable declared in the program, and has the initial value, in the program run in a writable memory area, generally Initialized Global Variables , initialized static local variable .

3) uninitialized segment (BSS): Uninitialized data is declared in the program, but there are no initialized variables, which belong to the static store. Uninitialized data segments are generated only during the initialization phase of the run, so its size does not affect the size of the destination file. In a program, there are generally no initialized global variables and static local variables that are not initialized .



From for notes (Wiz)

List of attachments

    6.4 Districts. doc

    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.