在C语言中,内存的主要分为下列几部分:

1. Text/Code Segment 文本/代码区

2. Initialized Data Segments 初始化的数据区

3. Uninitialized Data Segments 未初始化的数据区

4. Stack Segment 栈区

5. Heap Segment 堆区

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAN8CAAAAADHB8h3AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAP+Hj8y/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAsK0lEQVR42u3deUhU6xsH8Oc9ZzbHGXXSXDLNMiu72Xrbbve23Pao20IbllTcoqIiqSiMIlEUUQxRRJEzDGJEFBERUURIiERERESESIgIIiIiiIgMDOf3nmXGGRuXbrfb/Jzv84cz551zzpzz8T3Pu8xGcl83YmLRR33zbXbEhGIlddsJMbFIULBMGbNHiYw4orhRH51kkWEiljzayWYkMw1rtjxqFDNWLIdLzCbx1agPvhKBBSxgAQtYwAIWsIAFLGABC1jAAhawgAUsYAELWMACFrCABSxgAQtYwAIWsIAFLGABC1jAAhawJhKerjdPnzS1uYE1fjxcZDOIoiEi5UrfNxGfmLGiPcywPKeN3rdLs+SnatGHuoae8Td0Z5DpfZhhXReIOf7Yt29dPCOKVg9wr2C8B6wg8WUKCTvUq6k7z0y0Xrm3hYR6YAWJPEZpQ/r9C4xiuoA1euwgOuC932kn8YE85N5IQu3QoFo0+OTW1aIXg8MZrvnGqQtSTyDWUH9ff1hgrSfa7ZPYm5LxXD7sMBHZYtbw+tZ/dpqB531j8jkd4+0KM89sQtz5IT+st5kxsZfCAms/kaMpoGSx1jTGD8r9axgxg0nkXmsGlIfuO/hdg8C5/nL7sF4lEZvfGhZYDbzqRO6ueO/xlUhHpxH77UiRRy4VyHqi6f2jLQYS7/NHWmKIEm80NawRyeDyYjXGElvRGyZdhy1M6WFZfjlc1uRNTVv1BJ9JrFQtOEz0t5bf0tSG8y+ipTr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8EsIAFLGABC1gIYAELWMACFrAQwAIWsIAFLGAhgAUsYAELWMBCAAtYwAIWsICFABawgAUsYAELASxgAQtYwAIWAljAAhawgAUsBLCABSxgAQtYCGABC1jAAhawEF6s5KZXiHGiqULHYiJi/CANCzGxSKC+lfEJiIlE/Kb/AQL62pVDMaJsAAAAaXRFWHRjb21tZW50AEZpbGUgc291cmNlOiBodHRwczovL2NvbW1vbnMud2lraW1lZGlhLm9yZy93aWtpL0ZpbGU6VHlwaWNhbF9jb21wdXRlcl9kYXRhX21lbW9yeV9hcnJhbmdlbWVudC5wbmdKTSYhAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTA5LTE0VDIzOjA3OjQ4KzAwOjAwtflBkQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0wOS0xNFQyMzowNzo0OCswMDowMMSk+S0AAABHdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuNy43LTEwIDIwMTQtMDMtMDYgUTE2IGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnb5+iogAAABh0RVh0VGh1bWI6OkRvY3VtZW50OjpQYWdlcwAxp/+7LwAAABl0RVh0VGh1bWI6OkltYWdlOjpoZWlnaHQAMzYxN30a4SoAAAAYdEVYdFRodW1iOjpJbWFnZTo6V2lkdGgAMTIxN0PP0rMAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9wbmc/slZOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ0MjI3MjA2ODJM0hIAAAASdEVYdFRodW1iOjpTaXplADExMUtCQgxSACkAAAAASUVORK5CYII=" alt="" width="140" height="417" />

Text/Code Segment 文本/代码区

这个区主要用来保存机器代码,一个可执行对象文件的文本区通常是只读区,可以防止程序被意外修改。文本/代码区可能会被放在堆和栈的下方来防止堆和栈的覆写溢出。

Initialized Data Segments 初始化的数据区

初始化的数据区存储了所有的初始化了的全局的,静态的,常量的,外部的变量。这些变量没有在函数内部定义或者是以静态的方式在函数内部定义了,比如下面两种情况:

int val = ;
char string[] = "Hello World";

这些变量最初是保存在只读内存中(Text/Code Segment 文本/代码区中),然后被拷贝到了初始化的数据区。

Uninitialized Data Segments 未初始化的数据区

未初始化的数据区,又称作BSS (Block Started by Symbol),这个区一般紧连着初始化的数据区,用来保存所有的初始化为0的全局变量和静态变量,或者没有初始化,比如 static int i;将会存在BSS中。

Stack Segment 栈区

栈区是紧连着堆区的,堆和栈的增长方向相反,当堆和栈的指针重合时,此时内存被耗尽。栈区是以后进先出的机制运行的,通常在内存的高地址处。当一个函数被调用时,该函数的返回地址和调用者的环境信息被保存在栈中,新调用的函数再在栈上开辟空间保存自动和临时变量,这就是递归函数的运行机制。当一个递归函数调用它本身时,一个新的栈格被使用,所以这些变量不会跟上次递归的变量相互干扰。栈区主要保存一些局部变量。

Heap Segment 堆区

堆区主要用来动态分配内存。通过malloc, realloc和free来管理。堆区被所有线程,公用库,动态加载模块所共享。

关于堆和栈的区别,可参见我的另一篇博客Stack and Heap 堆和栈的区别

C Memory Layout C语言中的内存布局的更多相关文章

  1. C语言中动态内存分配的本质是什么?

    摘要:C语言中比较重要的就是指针,它可以用来链表操作,谈到链表,很多时候为此分配内存采用动态分配而不是静态分配. 本文分享自华为云社区<[云驻共创]C语言中动态内存分配的本质>,作者: G ...

  2. windev中的内存机制及其与C语言中的内存指针相似性(一)

    windev中的内存机制,是初入windev世界必须要越过的一道高山,以下我的理解和经验未必都对,如有错误或遗漏,以后再纠正或补充!另外,以下内容,咱先谈应用,再说对机制的认识和理解. 一.新建表单, ...

  3. C语言中的内存分配与释放

    C语言中的内存分配与释放 对C语言一直都是抱着学习的态度,很多都不懂,今天突然被问道C语言的内存分配问题,说了一些自己知道的,但感觉回答的并不完善,所以才有这篇笔记,总结一下C语言中内存分配的主要内容 ...

  4. C语言中的内存压缩技术

    C语言中的内存压缩技术 前言 在整个研究生阶段我都在参与一个LTE协议栈实现的项目,在这个项目中,我们利用一个自己编写的有限状态机框架将协议栈中每一层实现为一个内核模块.我们知道,在编写内核代码时需要 ...

  5. C语言中的内存管理

    开始陆续的发一下唐老师视频的笔记吧,顺便带一些正冲哥书的的内容.不能一下都发出来,因为内容发多了自己也受不了,而且发的都是学习视频时候的一些笔记,可能会有一些问题不是很清晰. 先说一下C语言中的内存管 ...

  6. C语言中的内存对齐

    最近看了好多,也编了好多C语言的浩强哥书后的题,总觉的很不爽,真的真的好怀念linux驱动的代码,好怀念那下划线,那结构体,虽然自己还很菜. 同时看了一遍陈正冲老师的C语言深度剖析,收益很多,又把唐老 ...

  7. 重磅硬核 | 一文聊透对象在 JVM 中的内存布局,以及内存对齐和压缩指针的原理及应用

    欢迎关注公众号:bin的技术小屋 大家好,我是bin,又到了每周我们见面的时刻了,我的公众号在1月10号那天发布了第一篇文章<从内核角度看IO模型的演变>,在这篇文章中我们通过图解的方式以 ...

  8. c++继承中的内存布局

    今天在网上看到了一篇写得非常好的文章,是有关c++类继承内存布局的.看了之后获益良多,现在转在我自己的博客里面,作为以后复习之用. ——谈VC++对象模型(美)简.格雷程化    译 译者前言 一个C ...

  9. C++继承 派生类中的内存布局(单继承、多继承、虚拟继承)

    今天在网上看到了一篇写得非常好的文章,是有关c++类继承内存布局的.看了之后获益良多,现在转在我自己的博客里面,作为以后复习之用. ——谈VC++对象模型(美)简.格雷程化    译 译者前言 一个C ...

随机推荐

  1. DP:Cheapest Palindrome(POJ 3280)

    价值最小回文字符串 题目大意:给你一个字符串,可以删除可以添加,并且每一次对一个字母的操作都带一个权,问你转成回文串最优操作数. 如果这一题我这样告诉你,你毫无疑问知道这一题是LD(Levenshti ...

  2. SQLServer语句大使

    1.创建数据库create database 数据库名字 2.删除数据库drop database 数据库名字3.创建表(identity(1,1)自动增长,倍数为1,primary key设置主键) ...

  3. OC内存管理(MRC)

    首先说明一下几块存储区域: 栈区(局部变量.函数参数值) 堆区(对象.手动申请/释放内存) BSS区(未初始化的全局变量.未初始化的静态数据) 常量区(字符串常量以及初始化后的全局变量.初始化后的静态 ...

  4. Fresco 源码分析(三) Fresco服务端处理(3) DataSource到Producer的适配器逻辑以及BitmapMemoryCacheProducer处理的逻辑

    4.3.1.2.1 Producer和DataSource之间适配器处理的逻辑 还是从程序的入口开始说吧 CloseableProducerToDataSourceAdapter.create() 源 ...

  5. 企业级项目中最常用到的SQL

    用SQL语句添加删除修改字段 1.增加字段     alter table docdsp    add dspcode char(200) 例如: 表gwamis.d410Sctzmx添加字段f410 ...

  6. thinkphp实现导航高亮的简单方法

    经常会涉及到关于导航菜单高亮显示的问题,大多是通过配合js或者事先分配变量的方式来实现导航高亮的,这里提供另一种思路参考: <ul class="usermenu"> ...

  7. poj 3281 最大流+建图

    很巧妙的思想 转自:http://www.cnblogs.com/kuangbin/archive/2012/08/21/2649850.html 本题能够想到用最大流做,那真的是太绝了.建模的方法很 ...

  8. Synergy

    Synergy 可以在多台电脑之间共享鼠标.键盘.剪贴板.Synergy是一套开源共享软件,完美跨 Win.Linux.Mac运行.真正做到使用一套键盘和鼠标就可控制多个电脑. 下载地址:http:/ ...

  9. linux socket 编程(C语言)

    转自:http://blog.csdn.net/piaojun_pj/article/details/5920888 最近看了一些网络编程的书籍,一直以来总感觉网络编程神秘莫测,其实网络编程入门还是很 ...

  10. WPF/Silverlight Template使用及总结(转)

    WPF/Silverlight 中的控件都有Style和Template两种属性.前者解释为样式,是用来改变控件原有属性的,比如 Button 控件的(Width,Height,Background ...