当前位置:网站首页>程序的内存模型
程序的内存模型
2022-07-02 06:26:00 【想搞钱的小陈】
内存分区模型。
内存分为4个区域,分别为代码区,全局区,栈区,堆区。
当一个进程开始时,就有分配以下4个区域。

(一)代码区和全局区
在程序编译后,会生成一个exe的可执行程序,未执行该程序前分为两个区域,代码区和全局区。
代码区
- 存放函数体的二进制代码,由操作系统进行管理。
- 存放CPU执行的机器指令。
- 代码区是共享的,共享的目的是对于频繁被执行的程序,只需要在内存中有一份代码就可,去掉冗余的代码。
- 代码区是只读的,只读的目的是防止程序被修改它的指令。
全局区
存放全局变量和静态变量(static int a), 包含了常量区,(字符串常量,其他常量const修饰的变量)
const修饰的全局变量放在全局区,const修饰的局部变量放在代码区。
栈区:
存放的是子程序的返回地址、子程序的参数、以及程序的局部变量。
堆区:
存放动态分配的数据 例如:new 和malloc。
边栏推荐
- Optimization method: meaning of common mathematical symbols
- allennlp 中的TypeError: Object of type Tensor is not JSON serializable错误
- 【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
- Faster-ILOD、maskrcnn_ Benchmark training coco data set and problem summary
- 实现接口 Interface Iterable<T>
- Play online games with mame32k
- PHP returns the abbreviation of the month according to the numerical month
- yolov3训练自己的数据集(MMDetection)
- [medical] participants to medical ontologies: Content Selection for Clinical Abstract Summarization
- [introduction to information retrieval] Chapter 1 Boolean retrieval
猜你喜欢
随机推荐
parser.parse_args 布尔值类型将False解析为True
Oracle general ledger balance table GL for foreign currency bookkeeping_ Balance change (Part 1)
Feeling after reading "agile and tidy way: return to origin"
Oracle 11g uses ords+pljson to implement JSON_ Table effect
Generate random 6-bit invitation code in PHP
机器学习理论学习:感知机
parser. parse_ Args boolean type resolves false to true
Drawing mechanism of view (II)
[introduction to information retrieval] Chapter 1 Boolean retrieval
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'
spark sql任务性能优化(基础)
如何高效开发一款微信小程序
MySQL组合索引加不加ID
JSP intelligent community property management system
离线数仓和bi开发的实践和思考
Calculate the difference in days, months, and years between two dates in PHP
Pratique et réflexion sur l'entrepôt de données hors ligne et le développement Bi
view的绘制机制(二)
Delete the contents under the specified folder in PHP
【信息检索导论】第一章 布尔检索









