A program's memory usage typically includes four different regions:

  • Code -- The region where the program instructions are stored.
  • Static memory -- The region where global variables (variable defined outside any function) as well as static local variables (variables defined inside functions starting with the keyword "static") are allocated. The name "static" comes from these variables not changing (static means not changing); they are allocated once and last for the duration of a program's execution, their addresses staying the same.
  • The stack -- The region where a function's local variables are allocated during a function call. A function call adds local variables to the stack, and a return removes them, like adding and removing dishes from a pile; hence the term "stack." Because this memory is automatically allocated and deallocated, it is also called automatic memory.
  • The heap -- The region where the "new" operator allocates memory, and where the "delete" operator deallocates memory. The region is also called free store

The Following shows how them work

Memory Region的更多相关文章

  1. PatentTips - Maintaining shadow page tables in a sequestered memory region

    BACKGROUND Malicious code, known as malware, which includes viruses, worms, adware, etc., may attack ...

  2. Off-heap Memory in Apache Flink and the curious JIT compiler

    https://flink.apache.org/news/2015/09/16/off-heap-memory.html   Running data-intensive code in the J ...

  3. 程序空间(Program memory)

    The computer program memory is organized into the following: Data Segment (Data + BSS + Heap) Stack ...

  4. Embedded之memory test

    1 main.c #include "led.h" #define BASE_ADDRESS (volatile datum *) 0x10000000 #define NUM_B ...

  5. Linker scripts之MEMORY

    1 MEMORY command The MEMORY command describes the location and size of blocks of memory in the targe ...

  6. Anatomy of a Program in Memory

    Memory management is the heart of operating systems; it is crucial for both programming and system a ...

  7. qualcomm memory dump 抓取方法

    Memory dump是系统出现crash时常用的分析故障原因的方法,qualcomm 各子系统运行时,为方便debug,都会开辟ram log和debug variable用于保存各系统运行信息及健 ...

  8. [转]Anatomy of a Program in Memory

    Memory management is the heart of operating systems; it is crucial for both programming and system a ...

  9. Linux kernel Programming - Allocating Memory

    kmalloc #include <linux/slab.h> void *kmalloc(size_t size,int flags); void kfree(void *addr); ...

随机推荐

  1. swift闭包-备

    我给Swift 中的闭包一个定义:闭包是自包含的匿名函数代码块,可以作为表达式.函数参数和函数返回值,闭包表达式的运算结果是一种函数类型. Swift中的闭包类似于Objective-C中的代码块.J ...

  2. JQuery的插件

    最近需要修改ftl文件,使用一般的freemarker插件不能有效处理里边的部分JQuery内容,所以特地下载了一个Spket插件, 地址为 http://www.agpad.com/update 再 ...

  3. Hunt the Wumpus第二个版本---多怪兽,多洞穴,洞穴间双向互通

    其中,将洞穴连起来的算法要好好体会. 学习构建临时变量列表,确认循环用FOR,非确定循环用 WHILE,并定好退出条件. from random import choice cave_numbers ...

  4. win10系统加载ahci驱动的操作方案(Win10之家)

    win10系统使用的过程中很多用户会想要加载ahci驱动,但是大部分用户根本不知道怎么操作加载ahci驱动,这样的话很多用户会遇到一些问题,那如果使用的过程中想要加载ahci驱动的话我们应该怎么操作呢 ...

  5. Linux企业级项目实践之网络爬虫(5)——处理配置文件

    配置文件在Linux下使用得非常普遍,但是Linux下没有统一个配置文件标准. 我们把配置文件的规则制定如下: 1.把"#"视作注释开始 2.所有的配置项都都是以键值对的形式出现 ...

  6. C++基础回顾1(数据类型, 控制语句, 数组)

    最近两天打开本科学校的C++教材,快速回顾了一下C++方面的内容.虽然书本内容比较基础,但是还是有些知识点值得自己强化记忆.分几篇文章,加上自己的理解记录如下. 先回顾面向过程的部分. C++数据类型 ...

  7. 手游与App测试如何快速转型? —— 过来人科普手游与App测试四大区别

    随着智能设备的普及和移动互联网的兴起,各家互联网巨头纷纷在往移动端布局和转型,同时初创的移动互联网公司也都盯着这个市场希望分一杯羹.在这个大环境下,互联网的重心已经慢慢从Web端转向了移动端,而移动端 ...

  8. animation之translate、scale、alpha、rotate动画效果呈现

    动画类型 Android的animation由四种类型组成 XML中 alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画效果 translate 画面转换位置移动动画效果 rotate 画面 ...

  9. C# 合成图片

    教师节快到了,给那些年的老师拼个图 前端有脸.眉.眼.特征.气泡等多元素图片 后端将最后选中元素的ID,合成“脸谱” /// <summary> /// 合并图片 /// </sum ...

  10. Hibernate的查询 HQL查询 查询某几列

    HQL 是Hibernate Query Language的简写,即 hibernate 查询语言:HQL采用面向对象的查询方式.HQL查询提供了更加丰富的和灵活的查询特性,因此Hibernate将H ...