当前位置:网站首页>程序的内存模型
程序的内存模型
2022-07-02 06:26:00 【想搞钱的小陈】
内存分区模型。
内存分为4个区域,分别为代码区,全局区,栈区,堆区。
当一个进程开始时,就有分配以下4个区域。
(一)代码区和全局区
在程序编译后,会生成一个exe的可执行程序,未执行该程序前分为两个区域,代码区和全局区。
代码区
- 存放函数体的二进制代码,由操作系统进行管理。
- 存放CPU执行的机器指令。
- 代码区是共享的,共享的目的是对于频繁被执行的程序,只需要在内存中有一份代码就可,去掉冗余的代码。
- 代码区是只读的,只读的目的是防止程序被修改它的指令。
全局区
存放全局变量和静态变量(static int a), 包含了常量区,(字符串常量,其他常量const修饰的变量)
const修饰的全局变量放在全局区,const修饰的局部变量放在代码区。
栈区:
存放的是子程序的返回地址、子程序的参数、以及程序的局部变量。
堆区:
存放动态分配的数据 例如:new 和malloc。
边栏推荐
- [introduction to information retrieval] Chapter 6 term weight and vector space model
- Alpha Beta Pruning in Adversarial Search
- Mmdetection installation problem
- Regular expressions in MySQL
- MMDetection安装问题
- Calculate the difference in days, months, and years between two dates in PHP
- MySQL无order by的排序规则因素
- 矩阵的Jordan分解实例
- 一个中年程序员学习中国近代史的小结
- How to efficiently develop a wechat applet
猜你喜欢
Oracle EBs and apex integrated login and principle analysis
Tencent machine test questions
【论文介绍】R-Drop: Regularized Dropout for Neural Networks
架构设计三原则
【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦
离线数仓和bi开发的实践和思考
使用 Compose 实现可见 ScrollBar
Sparksql data skew
基于pytorch的YOLOv5单张图片检测实现
Point cloud data understanding (step 3 of pointnet Implementation)
随机推荐
深度学习分类优化实战
【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
【论文介绍】R-Drop: Regularized Dropout for Neural Networks
Optimization method: meaning of common mathematical symbols
Module not found: Error: Can't resolve './$$_ gendir/app/app. module. ngfactory'
@Transitional step pit
[tricks] whiteningbert: an easy unsupervised sentence embedding approach
使用MAME32K进行联机游戏
Implement interface Iterable & lt; T>
Oracle segment advisor, how to deal with row link row migration, reduce high water level
PointNet原理证明与理解
Oracle EBs and apex integrated login and principle analysis
離線數倉和bi開發的實踐和思考
Using MATLAB to realize: Jacobi, Gauss Seidel iteration
Jordan decomposition example of matrix
PHP returns the corresponding key value according to the value in the two-dimensional array
win10+vs2017+denseflow编译
Get the uppercase initials of Chinese Pinyin in PHP
使用Matlab实现:Jacobi、Gauss-Seidel迭代
PointNet理解(PointNet实现第4步)