- 浏览: 1129613 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
未完 JVM Runtime Data Areas & Java Memory Model | 内存分配模型 & Java数据存储
- 博客分类:
- Java Foundation
Java虚拟机内存分配模型
需精读:Chapter 5 of Inside the Java Virtual Machine - The Java Virtual Machine:
http://www.artima.com/insidejvm/ed2/jvm2.html
http://blog.jamesdbloom.com/JVMInternals.html
Java Virtual Machine Specification - Runtime Data Areas:
http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.5
http://blog.csdn.net/silentbalanceyh/article/details/4661230
Java Memory Model:
jls 17.4 - Memory Model:
http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4
The Java Memory Model:
http://www.cs.umd.edu/~pugh/java/memoryModel/index.html#reference
JSR-133: Java Memory Model and Thread Specification:
https://www.cs.umd.edu/users/pugh/java/memoryModel/jsr133.pdf
关于java的内存分配,网上有种提法说分heap/stack/data segment/code segment。如下:
http://wenku.baidu.com/view/efa5a3d9a58da0116c174988.html
不知道这是谁发明的,不过这种提法是不正确的。stack和heap java中是有没错,但data segment 和 code segment,是C语言内存分配中的概念,也是大学组成原理课里的概念,在java世界里,没这种说法!
参考:http://www.coderanch.com/t/392047/java/java/Code-Data-segment
需精读:Chapter 5 of Inside the Java Virtual Machine - The Java Virtual Machine:
http://www.artima.com/insidejvm/ed2/jvm2.html
引用
所有的对象都是分配在heap上的
http://blog.jamesdbloom.com/JVMInternals.html
引用
Java Virtual Machine Specification - Runtime Data Areas:
http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.5
引用
The pc Register
Each Java virtual machine thread has its own pc (program counter) register.
Java Virtual Machine Stacks
Each Java virtual machine thread has a private Java virtual machine stack, created at the same time as the thread. A Java virtual machine stack stores frames.
每个线程有各自独立的Stack实例,存放:局部变量 / 方法参数 / 中间计算结果
Heap
The Java virtual machine has a heap that is shared among all Java virtual machine threads. The heap is the runtime data area from which memory for all class instances and arrays is allocated.
jvm中只有一个Heap实例,存放:实例变量 / 所有的对象 ....and ..?
Method Area
The Java virtual machine has a method area that is shared among all Java virtual machine threads. The method area is analogous to the storage area for compiled code of a conventional language or analogous to the "text" segment in an operating system process. It stores per-class structures such as the runtime constant pool, field and method data, and the code for methods and constructors, including the special methods (§2.9) used in class and instance initialization and interface initialization.
jvm中只有一个Method Area实例,存放:类变量 / information about loaded types(class,interface,etc)...and ..?
Runtime Constant Pool
A runtime constant pool is a per-class or per-interface runtime representation of the constant_pool table in a class file (§4.4). It contains several kinds of constants, ranging from numeric literals known at compile-time to method and field references that must be resolved at runtime. The runtime constant pool serves a function similar to that of a symbol table for a conventional programming language, although it contains a wider range of data than a typical symbol table.
Constant pool 位于 Method Area 中。
Native Method Stacks
Java内存模型:
Each Java virtual machine thread has its own pc (program counter) register.
Java Virtual Machine Stacks
Each Java virtual machine thread has a private Java virtual machine stack, created at the same time as the thread. A Java virtual machine stack stores frames.
每个线程有各自独立的Stack实例,存放:局部变量 / 方法参数 / 中间计算结果
Heap
The Java virtual machine has a heap that is shared among all Java virtual machine threads. The heap is the runtime data area from which memory for all class instances and arrays is allocated.
jvm中只有一个Heap实例,存放:实例变量 / 所有的对象 ....and ..?
Method Area
The Java virtual machine has a method area that is shared among all Java virtual machine threads. The method area is analogous to the storage area for compiled code of a conventional language or analogous to the "text" segment in an operating system process. It stores per-class structures such as the runtime constant pool, field and method data, and the code for methods and constructors, including the special methods (§2.9) used in class and instance initialization and interface initialization.
jvm中只有一个Method Area实例,存放:类变量 / information about loaded types(class,interface,etc)...and ..?
Runtime Constant Pool
A runtime constant pool is a per-class or per-interface runtime representation of the constant_pool table in a class file (§4.4). It contains several kinds of constants, ranging from numeric literals known at compile-time to method and field references that must be resolved at runtime. The runtime constant pool serves a function similar to that of a symbol table for a conventional programming language, although it contains a wider range of data than a typical symbol table.
Constant pool 位于 Method Area 中。
Native Method Stacks
http://blog.csdn.net/silentbalanceyh/article/details/4661230
Java Memory Model:
jls 17.4 - Memory Model:
http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4
The Java Memory Model:
http://www.cs.umd.edu/~pugh/java/memoryModel/index.html#reference
JSR-133: Java Memory Model and Thread Specification:
https://www.cs.umd.edu/users/pugh/java/memoryModel/jsr133.pdf
关于java的内存分配,网上有种提法说分heap/stack/data segment/code segment。如下:
http://wenku.baidu.com/view/efa5a3d9a58da0116c174988.html
不知道这是谁发明的,不过这种提法是不正确的。stack和heap java中是有没错,但data segment 和 code segment,是C语言内存分配中的概念,也是大学组成原理课里的概念,在java世界里,没这种说法!
参考:http://www.coderanch.com/t/392047/java/java/Code-Data-segment
引用
Q:
Can anyone help me knowing what role exactly code segment and data segment plays in general in Java?
A:
I am not exactly sure what you mean by "code segment" etc.
When a class is used in any manner, it is automatically "loaded" the first time by the JVM. This causes a Classfile to be created for it, all the code is loaded into the Method Area, and any static initializers are executed.
Methods, constructors and initializing code (both static and non-static) are kept in the Method Area of the Classfile. There is no "per instance" implementation of code. The classfile and it's methods stay until the class is unloaded. Most of the classes that you will use as a beginner are loaded by the bootstrap classloader and stay put until the JVM comes down.
Data that is related to a particular object of the class (fields) are kept in the object itself on the heap. So each object has a field that relates to each variable that defines it's current state. If it inherits variable from a Super class, the object has a place for that also (even if it is hidden by a variable with the same name in the subclass).
Static variables are kept in a central location related to the Classfile. These variables are "shared" by all instances of the class. Of course those variables may hold references to objects which are themselves on the heap.
Can anyone help me knowing what role exactly code segment and data segment plays in general in Java?
A:
I am not exactly sure what you mean by "code segment" etc.
When a class is used in any manner, it is automatically "loaded" the first time by the JVM. This causes a Classfile to be created for it, all the code is loaded into the Method Area, and any static initializers are executed.
Methods, constructors and initializing code (both static and non-static) are kept in the Method Area of the Classfile. There is no "per instance" implementation of code. The classfile and it's methods stay until the class is unloaded. Most of the classes that you will use as a beginner are loaded by the bootstrap classloader and stay put until the JVM comes down.
Data that is related to a particular object of the class (fields) are kept in the object itself on the heap. So each object has a field that relates to each variable that defines it's current state. If it inherits variable from a Super class, the object has a place for that also (even if it is hidden by a variable with the same name in the subclass).
Static variables are kept in a central location related to the Classfile. These variables are "shared" by all instances of the class. Of course those variables may hold references to objects which are themselves on the heap.
发表评论
-
J2SE Evolution
2013-04-11 15:39 1157Java 7 New Features Java SE 7 ... -
未完 Java: IO & NIO(new I/O)
2013-01-11 20:56 1990适用: event and data-driven apps ... -
未完 java设计: naming convention | 命名规范
2012-11-20 16:45 2094应该遵循的规范: 类/接口/属性名,使用名词或形容词 ... -
未完 Java: enum 枚举
2012-11-19 20:29 1764http://stackoverflow.com/que ... -
Java多线程之 concurrent 并发包
2012-11-01 07:47 1957Java Tutorials -> Concur ... -
未完 Java Tips & Tricks & Notes
2012-09-12 10:00 1079Hidden Features of Java: h ... -
未完 Java Socket
2012-09-12 08:42 977Java SocketJava SocketJava Sock ... -
Java For-each Loop & Iterable | 增强型For循环和Iterable接口
2012-09-11 21:50 2004增强型For循环没什么好说的,Just see link ... -
未完 Java Collections | 容器
2012-09-06 11:35 1795Sources: http://docs.oracle.com ... -
Java object Initialization (class Instantiation) | 对象的初始化(即类的实例化)
2012-09-03 09:12 2949类实例即对象 ... -
未完Java class&interfac 's Loading, Linking and Initializing | 类与接口的加载、链接和初始化
2012-08-31 19:01 1613JVM装载一个类的时候,首先检查他有没有父类,如果有父类则装载 ... -
未完 java Static 总结
2012-08-31 18:47 1365static可以用来修饰: 字段 Fields 方法 Meth ... -
Java Data Types & Literals | 数据类型 和 字面量
2012-08-30 18:12 3856Java数据类型划分: OR http:// ... -
未完 Variables 变量 (Instance/Class/Local)
2012-08-29 10:59 1644Local/Instance/Class Variables ... -
未完 Regular Expressions | 正则表达式
2011-08-25 11:43 1485Extended Regular Expression ... -
java Date(util.Date/sql.Date/sql.Timestamp/sql.Time) & Oracle DATE Type 时分秒 精度问题
2011-05-17 09:32 3893遇到的问题描述: 数据库为Oracle,其jdbc驱动为ojd ... -
Java byte code (bytecode)
2011-05-04 02:55 3842keys: bytecode, byte code, opco ... -
Java Classloading Mechanism : ClassLoader & ASM & 动态字节码增强
2011-04-21 13:29 2384Setting the class path: http:// ... -
class literal & instance.getClass() & Class.forName(String className)
2011-04-20 12:33 2291常用的几种取得Class类实例的方式: 1 class lit ... -
Java 数值计算
2011-04-20 02:44 2052java.lang.Math's floor(),ceil() ...
相关推荐
关于java的内存分配问题,jvm的运行原理相关资料总结
由于JVM运行程序的实体是线程,而每个线程创建时JVM都会为其创建一个工作内存(有些地方称为栈空间),工作内存是每个线程的私有数据区域,而Java内存模型中规定
主要是JVM内存分配及简单的JVM性能调优
虽然Java中所有对象的存储空间都是在堆中分配的,但是这个对象的引用却是在栈中分配,也就是说在建立一个对象时在堆和栈中都分配内存,在堆中分配的内存实际存放这个被创建的对象的本身,而在栈中分配的内存只是存放...
Java 虚拟机JVM内存模型与垃圾收集策略,看完此资料,JVM将不再话下
inside java virtual machine 2nd(深入JVM虚拟机 英文1&2版 ).rar
jvm性能调优-jvm内存模型和优化-performance-jvm-memorymodel-optimize
性能测试,线程的 dump 看到线程的 死锁,等待 运行状态
java jvm内存模型
NULL 博文链接:https://younglibin.iteye.com/blog/1959816
long果 深入理解Java虚拟机(jvm性能调优+内存模型+虚拟机原理)。讲解相当详细,值得一看。下载仅供参考学习,侵权联删。
java获得jvm内存大小
对jvm内存模型&垃圾收集算法&类加载机制进行了整理,读者可以作为参考进行学习和探讨,,
jvm内存模型,jvm脑图,jvm调优,jvm垃圾回收算法,jvm垃圾回收器,逃逸算法等总结。
JVM内存段分配,Java垃圾回收调优,Heap设定
JVM内存结构Java 代码是要运行在虚拟机上的,而虚拟机在执行 Java 程序的过程中会把所管理的内存划分为若干个不同的数据区域,这些区域都有各自的用途。如果
30+个视频+深入理解Java虚拟机(jvm优化+内存模型+虚拟机原理)
JRE(Java Runtime Environment)——windows Java运行环境 64bit
主要为大家讲解JVM内存模型|内存结构|内存屏障,他们的概念,有什么关联以及各种的功能
zabbix自动发现JAVA进程,并进行自动添加监控JAVA 进程的JVM数据,统计分析告警监控。 支持多种中间件,tomcat、weblogic、微服务方式部署JAVA应用监控。 自带发现脚本和监控脚本,以及zabbix导入模板。