- 4
- 0
- 约1.44万字
- 约 16页
- 2017-08-31 发布于河南
- 举报
c编译的程序占用的内存(C compiled programs take up memory)
c编译的程序占用的内存(C compiled programs take up memory) C compiled programs take up.Txt of memory A program compiled by c/C++ occupies the following sections of memory 1, the stack area (stack) - the program runs automatically by the compiler allocation, storage function parameters, local variables and so on. Its operation is similar to the stack in the data structure. At the end of the program, it is automatically released by the compiler. 2, heap area (heap) - open another storage area in memory. Generally distributed by programmer, if the programmer does not release, the program may be recycled by OS at the end of the program. Notice that it is different from the heap in the data structure, but the distribution method is similar to the linked list. 3, global (static) (static) - the compiler allocates memory when it is compiled. Global and static variables stored is placed on a piece of the initialization of global and static variables in a region, uninitialized global variables and static variables uninitialized in another area adjacent to the. - release of the system after the program is finished 4, the text constant area - constant string is placed here. The system is released at the end of the program 5, program code area - the binary code that holds the function body. Example program It was written by a senior, very detailed //main.cpp Int a = 0; global initialization area Char *p1; global uninitialized region (main) { Int b; / / stack Char s[] = ABC; / / stack Char *p2; / / stack Char *p3 = 123456; / / 123456\0 in the constant region, P3 on the stack. Static int c =0; / / global (static) initialization zone P1 = (char *) malloc (10); P2 = (char *) malloc (20); The distribution of 10 and 20 / more bytes in the area heap area. Strcpy (P1, 123456); //123456\0 is placed in the constant section, and the compiler might optimize it with the 123456 point P3 points to. } =============== Memory allocation in C language programs 1. memory allocation There are three ways to all
您可能关注的文档
- 10《葡萄沟》教学设计之五(10 teaching design of grape ditch five).doc
- 10《葡萄沟》第二课时教学设计之二(10, grape ditch second class teaching design two).doc
- 10《葡萄沟》第二课时教学设计之四(10, grape ditch second class teaching design four).doc
- 10个励志故事(10 inspiring stories).doc
- 10大管理讲解(Top 10 management explanations).doc
- 10年动画谈(10 years animation talk).doc
- 10款海绵蛋糕制作方法(10 sponge cake making method).doc
- 10款海绵蛋糕配方(10 sponge cake recipe).doc
- 10通经力士乐4we10g3x(10 - Rexroth 4we10g3x).doc
- 112佛与魔(112 Buddhas and Demons).doc
最近下载
- 反应机理(研)-高等无机化学.ppt VIP
- 218SS-PKE 摩托车操作说明书.pdf
- 2025年高考甘肃卷物理真题.docx VIP
- 凯恩帝K1TBIII-A-As数控系统用户手册.pdf
- 杭州电子科技大学信息工程学院2025-2026学年《概率论与数理统计2》第一学期期末试题(B).docx VIP
- 第2章 有理数的运算(单元测试·培优卷)含答案-2024人教版七年级数学上册.pdf VIP
- 中考1600词汇对照表(英译汉).doc VIP
- 杭州电子科技大学2025-2026学年《概率论与数理统计2》第一学期期末试题(B).docx VIP
- 香农三大定理详解.ppt VIP
- 【初中物理】专项练习:物体的密度及其测定40题(附答案).pdf VIP
有哪些信誉好的足球投注网站
文档评论(0)