当前位置:网站首页>程序的内存模型
程序的内存模型
2022-07-02 06:26:00 【想搞钱的小陈】
内存分区模型。
内存分为4个区域,分别为代码区,全局区,栈区,堆区。
当一个进程开始时,就有分配以下4个区域。
(一)代码区和全局区
在程序编译后,会生成一个exe的可执行程序,未执行该程序前分为两个区域,代码区和全局区。
代码区
- 存放函数体的二进制代码,由操作系统进行管理。
- 存放CPU执行的机器指令。
- 代码区是共享的,共享的目的是对于频繁被执行的程序,只需要在内存中有一份代码就可,去掉冗余的代码。
- 代码区是只读的,只读的目的是防止程序被修改它的指令。
全局区
存放全局变量和静态变量(static int a), 包含了常量区,(字符串常量,其他常量const修饰的变量)
const修饰的全局变量放在全局区,const修饰的局部变量放在代码区。
栈区:
存放的是子程序的返回地址、子程序的参数、以及程序的局部变量。
堆区:
存放动态分配的数据 例如:new 和malloc。
边栏推荐
- Faster-ILOD、maskrcnn_benchmark训练自己的voc数据集及问题汇总
- Convert timestamp into milliseconds and format time in PHP
- MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
- 【信息检索导论】第三章 容错式检索
- 基于onnxruntime的YOLOv5单张图片检测实现
- Drawing mechanism of view (II)
- 使用Matlab实现:Jacobi、Gauss-Seidel迭代
- 【Ranking】Pre-trained Language Model based Ranking in Baidu Search
- [introduction to information retrieval] Chapter 6 term weight and vector space model
- 中年人的认知科普
猜你喜欢
Alpha Beta Pruning in Adversarial Search
Oracle EBS ADI development steps
Three principles of architecture design
Practice and thinking of offline data warehouse and Bi development
Faster-ILOD、maskrcnn_benchmark安装过程及遇到问题
iOD及Detectron2搭建过程问题记录
Mmdetection installation problem
使用 Compose 实现可见 ScrollBar
Pratique et réflexion sur l'entrepôt de données hors ligne et le développement Bi
离线数仓和bi开发的实践和思考
随机推荐
Drawing mechanism of view (II)
SSM laboratory equipment management
Point cloud data understanding (step 3 of pointnet Implementation)
基于onnxruntime的YOLOv5单张图片检测实现
[torch] the most concise logging User Guide
allennlp 中的TypeError: Object of type Tensor is not JSON serializable错误
Module not found: Error: Can't resolve './$$_ gendir/app/app. module. ngfactory'
Sparksql data skew
Find in laravel8_ in_ Usage of set and upsert
MySQL has no collation factor of order by
SSM garbage classification management system
Ding Dong, here comes the redis om object mapping framework
Generate random 6-bit invitation code in PHP
【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦
Message queue fnd in Oracle EBS_ msg_ pub、fnd_ Application of message in pl/sql
離線數倉和bi開發的實踐和思考
Illustration of etcd access in kubernetes
Mmdetection installation problem
Oracle EBS ADI development steps
常见CNN网络创新点