GC中的栈(stack)、堆(heap)、 静态区(static) 的区别
来源:互联网 发布:如何安装管家婆软件 编辑:程序博客网 时间:2024/06/01 09:17
本文转自:http://blog.sina.com.cn/s/blog_4d52f5a701008opc.html
栈区(stack)—
堆区(heap) 一般由程序员分配释放,
静态区(static)—,全局变量和静态变量的存储是放在一块的,初始化的全局变量和静态变量在一块区域,
下面是引自[Think in C++]的一段原文:
The stack is an area in memory that is used directly by the microprocessor to store data during program execution.Variables on the stack are sometimes called automatic or scoped variables.
The second approach is to create objects dynamically in a pool of memory called the heap.In this approach you don’t know until runtime how many objects you need, what their lifetime is, or what their exact type is. Those decisions are made at the spur of the moment while the program is running. If you need a new object, you simply make it on the heap when you need it, using the new keyword. When you’re finished with the storage, you must release it using the delete keyword.
The static storage area is simply a fixed patch of memory that is allocated before the program begins to run.
从这段话可以理解出对象在栈中(stack)和静态区(static)程序员不能使用new和Delete来对其操作.因此栈中(stack)和静态区(static)的变量是不受程序员的程序控制的,既然不是由程序控制的?那是由誰控制的?其实可以这样理解的:由编译器控制的。
- GC中的栈(stack)、堆(heap)、 静态区(static) 的区别
- 内存中的栈(stack)、堆(heap)和静态区(static area)的用法
- java中的堆Heap和栈Stack的区别
- Java中的Stack栈和Heap堆的区别
- 解释Java中内存中的栈(stack)、堆(heap)和静态存储区的用法
- 栈stack 堆heap 全局区(静态区)static 文字常量区 程序代码区
- 堆(heap)和栈(stack)的区别
- 堆(heap)和栈(stack)的区别
- 堆(heap)与栈(stack)的区别
- 堆(heap)和栈(stack)的区别
- Stack栈和Heap堆的区别
- Heap(堆)和Stack(栈)的区别
- 堆Heap与栈Stack的区别
- 堆(heap)和栈(stack)的区别
- Stack栈和Heap堆的区别
- 堆和栈的区别(heap & Stack)
- 栈(Stack)和堆(Heap)的区别
- 堆(heap)和栈(stack)的区别
- 【leetcode】Linked List Cycle (python)
- 从文件读取数据构建单链表,返回链表头指针
- 【深入Java虚拟机】之六:Java语法糖
- db2 import 效率提高
- 图像切割还愿之金字塔
- GC中的栈(stack)、堆(heap)、 静态区(static) 的区别
- 根据权重随机选取指定条数记录的简单算法实现
- 菜鸟:只安装和配置instantclient,用plsql developer,navicat for oracle,sqlplus连接oracle数据库
- Android系统自带样式(android:theme)
- ceph启动时遇到osd.0 authentication error (1) Operation not permitted
- js
- 非常简单且易错的java Demo
- 关于Hbase的cache配置
- Android发送通知