当前位置:网站首页>程序的内存模型
程序的内存模型
2022-07-02 06:26:00 【想搞钱的小陈】
内存分区模型。
内存分为4个区域,分别为代码区,全局区,栈区,堆区。
当一个进程开始时,就有分配以下4个区域。
(一)代码区和全局区
在程序编译后,会生成一个exe的可执行程序,未执行该程序前分为两个区域,代码区和全局区。
代码区
- 存放函数体的二进制代码,由操作系统进行管理。
- 存放CPU执行的机器指令。
- 代码区是共享的,共享的目的是对于频繁被执行的程序,只需要在内存中有一份代码就可,去掉冗余的代码。
- 代码区是只读的,只读的目的是防止程序被修改它的指令。
全局区
存放全局变量和静态变量(static int a), 包含了常量区,(字符串常量,其他常量const修饰的变量)
const修饰的全局变量放在全局区,const修饰的局部变量放在代码区。
栈区:
存放的是子程序的返回地址、子程序的参数、以及程序的局部变量。
堆区:
存放动态分配的数据 例如:new 和malloc。
边栏推荐
猜你喜欢
@Transitional step pit
SSM laboratory equipment management
CSRF attack
A slide with two tables will help you quickly understand the target detection
自然辩证辨析题整理
[medical] participants to medical ontologies: Content Selection for Clinical Abstract Summarization
【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
Analysis of MapReduce and yarn principles
Faster-ILOD、maskrcnn_ Benchmark installation process and problems encountered
Faster-ILOD、maskrcnn_ Benchmark trains its own VOC data set and problem summary
随机推荐
MySQL无order by的排序规则因素
中年人的认知科普
如何高效开发一款微信小程序
allennlp 中的TypeError: Object of type Tensor is not JSON serializable错误
Implement interface Iterable & lt; T>
实现接口 Interface Iterable<T>
@Transitional step pit
Oracle EBS DataGuard setup
@Transational踩坑
Faster-ILOD、maskrcnn_benchmark训练自己的voc数据集及问题汇总
Play online games with mame32k
Agile development of software development pattern (scrum)
Ding Dong, here comes the redis om object mapping framework
传统目标检测笔记1__ Viola Jones
【Torch】最简洁logging使用指南
parser.parse_args 布尔值类型将False解析为True
Typeerror in allenlp: object of type tensor is not JSON serializable error
Practice and thinking of offline data warehouse and Bi development
生成模型与判别模型的区别与理解
ERNIE1.0 与 ERNIE2.0 论文解读