当前位置:网站首页>程序的内存布局
程序的内存布局
2022-07-25 12:38:00 【51CTO】
内存分为内核空间和用户空间。用户内存空间从低到高分为如下几个区域:
保留区:
内存中受到保护而禁止访问的内存区域,大多数操作系统中极小的地址通常是不允许访问的,所以C语言将无效指针赋值为0。
代码段:
存放可执行代码(二进制格式),以及常量值(如字符串常量),可以被多个程序共享,只读。
初始化数据段(.data):
存放已初始化的全局变量和静态变量。这种类型的数据,会在程序运行前分配内存空间。
未初始化数据段(.bss):
存放未初始化的全局变量和静态变量。.data段的所有数据已经划分好空间了,但是.bss段并没有给其中的数据划分空间。
这是全零的内存段,初始化为0的全局变量和静态变量也存放在这。
堆(.heap):
存放动态分配的内存,如使用malloc/calloc/realloc/new分配的内存。向上增上。一般比栈大很多。需要手动释放空间。
共享库的内存映射区:
存放动态库/静态库,以及文件映射,匿名映射等一切有依赖性的东西。
栈(.stack):
存放局部变量,函数的参数和返回值,以及函数调用前后需要保持不变的寄存器(上下文)。向下增长。操作系统自己回收空间。

参考:
https://blog.csdn.net/Code_beeps/article/details/89608929
(24条消息) 浅谈程序的内存布局_CSDN资讯的博客-CSDN博客
边栏推荐
- 【运维、实施精品】月薪10k+的技术岗位面试技巧
- Clickhouse notes 03-- grafana accesses Clickhouse
- Chapter5 : Deep Learning and Computational Chemistry
- Create directories and subdirectories circularly
- 阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程?
- Alibaba cloud technology expert Qin long: reliability assurance is a must - how to carry out chaos engineering on the cloud?
- [机器学习] 实验笔记 – 表情识别(emotion recognition)
- Interviewer: "classmate, have you ever done a real landing project?"
- Zero basic learning canoe panel (12) -- progress bar
- Leetcode 1184. distance between bus stops
猜你喜欢

Pytorch advanced training skills
![[shutter -- layout] stacked layout (stack and positioned)](/img/01/c588f75313580063cf32cc01677600.jpg)
[shutter -- layout] stacked layout (stack and positioned)

【Flutter -- 实例】案例一:基础组件 & 布局组件综合实例

Selenium use -- installation and testing

A hard journey

微软提出CodeT:代码生成新SOTA,20个点的性能提升

2022.07.24(LC_6126_设计食物评分系统)
What does the software testing process include? What are the test methods?

2022.07.24(LC_6124_第一个出现两次的字母)

Pytorch project practice - fashionmnist fashion classification
随机推荐
Use of Spirng @conditional conditional conditional annotation
【11】 Production and adjustment of vector and grid data Legends
CONDA common commands: install, update, create, activate, close, view, uninstall, delete, clean, rename, change source, problem
JS 将伪数组转换成数组
Keeping MySQL highly available
【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
Pytorch project practice - fashionmnist fashion classification
Chapter5 : Deep Learning and Computational Chemistry
Excuse me, using data integration to import data from PostgreSQL to MySQL database, emoj appears in some data fields
【3】 DEM mountain shadow effect
2022.07.24 (lc_6126_design food scoring system)
clickhouse笔记03-- Grafana 接入ClickHouse
力扣 83双周赛T4 6131.不可能得到的最短骰子序列、303 周赛T4 6127.优质数对的数目
深度学习MEMC插帧论文列表paper list
Kyligence 入选 Gartner 2022 数据管理技术成熟度曲线报告
Synergetic process
Alibaba cloud technology expert Qin long: reliability assurance is a must - how to carry out chaos engineering on the cloud?
[fluent -- example] case 1: comprehensive example of basic components and layout components
go : gin 自定义日志输出格式
"Autobiography of Franklin" cultivation