Data structure during running

Source: Internet
Author: User
Data structure during running

[Segment]

Text segments are also called code segments;

The data segment contains initialized global and static variables and their values;

The BSS (block started by symbol) segment contains uninitialized global variables and static variables;

The stack segment (stack) contains local variables, temporary data, parameters passed to the function, and is generated during runtime;

Heap is used to dynamically allocate memory (malloc). Common segment errors and memory leaks occur in the heap;

 

[Three Executable File segments]

Cjok @ Ubuntu :~ /Learn/C $ size A. out text data BSS dec hex filename 1017 264 8 1289 509 A. Out

 

[Comparison between segments and codes]

 

[Layout of segments in the executable files in the runtime in the memory]

 

If you have any questions, please contact me <cjok.liao@gmail.com> or leave a comment, we will exchange views, it's good for us, so great!

 

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.