Memory allocation when C program is compiled

  • bss: BSS is called Block Started by Symbol (or block storage segment). In an architecture that uses segmented memory management, the BSS segment (bss segment) usually refers to a memory area used to store uninitialized global variables in the program. The BSS segment belongs to static memory allocation.
  • .data: Represents the data segment (data segment), a memory area usually used to store initialized global variables in the program, also belongs to static memory allocation
  • .text: Represents a text segment (text segment), a memory area usually used to store code for program execution, the size of this area has been determined before the program runs, and the memory area is read-only, the code segment may also contain a small amount Read-only constant variables, such as string constants, etc.
  • COM: The full name is common segment. In the book "Self-cultivation of programmers", it is pointed out that if the value of the global variable initialization is not 0, it is stored in the data section. If the value is 0, it is stored in the bss section. When the variable is static and is not initialized, it is placed in the bss section, otherwise it is placed in the com section
Published 20 original articles · Likes6 · Visits 10,000+

Guess you like

Origin blog.csdn.net/weixin_36662608/article/details/73275355