Java Memory Basic
转自: http://www.blogjava.net/justinchen/archive/2009/justinchen/archive/2009/01/08/248738.html
GC and Full GC
The garbage collector (GC) detects garbage, defined as objects that are no longer reachable, then reclaims it and makes space available to the running program. The GC typically works in a stop-the-world fashion -- that is, it freezes the heap when working.
The above diagram describes the layout of HotSpot VM Heap and it consists of three parts: perm generation, old generation and new/yang generation. The perm generation is basically for class loading. Next are the old and young generation. The young generation is further broken up into three spaces: Eden, Survivor Space 1 (SS#1) and Survivor Space 2 (SS#2).
Garbage Collection1. When you have a new object, the object gets created in Eden space.
2. So after running for a while, Eden space will fill up.a minor garbage collection occurs, in which all the objects alive in Eden are copied over to SS#1. Eden is then empty and ready to receive new objects.
3. After the minor GC, objects are allocated to Eden again. After a time, the Eden space fills up again, and another minor GC occurs. The objects surviving in SS#1 and Eden are copied to SS#2, and both SS#1 and Eden are reset. Although objects are frequently recopied, either from Eden or from one SS to another, at any one time, only Eden and one SS are operating.
4. Every time an object moves from Eden to SS or from one SS to another, a counter and its header is incremented. By default, if the copying occurs 16 times or more, the HotSpot VM stops copying them and moves them to the old generation.
5. If an object can't be created in Eden, it goes directly to the old generation. Moving an object from SS to the old generation because of its age is called tenuring. Because of tenuring, the old generation becomes full over time. This calls for garbage collection of the old generation, which is called a full GC. A full GC is a compaction process that is slower than a minor GC.
Java Memory Basic的更多相关文章
- jmap命令(Java Memory Map)(转)
JDK内置工具使用 一.javah命令(C Header and Stub File Generator) 二.jps命令(Java Virtual Machine Process Status To ...
- Java Memory Management(1)
Java Memory Management, with its built-in garbage collection, is one of the language’s finest achiev ...
- 当我们在谈论JMM(Java memory model)的时候,我们在谈论些什么
前面几篇中,我们谈论了synchronized.final以及voilate的用法和底层实现,都绕不开一个话题-Java内存模型(java memory model,简称JMM).Java内存模型是保 ...
- 并发研究之Java内存模型(Java Memory Model)
Java内存模型JMM java内存模型定义 上一遍文章我们讲到了CPU缓存一致性以及内存屏障问题.那么Java作为一个跨平台的语言,它的实现要面对不同的底层硬件系统,设计一个中间层模型来屏蔽底层的硬 ...
- java学习:JMM(java memory model)、volatile、synchronized、AtomicXXX理解
一.JMM(java memory model)内存模型 从网上淘来二张图: 上面这张图说的是,在多核CPU的系统中,每个核CPU自带高速缓存,然后计算机主板上也有一块内存-称为主内(即:内存条).工 ...
- 五、jdk工具之jmap(java memory map)、 mat之四--结合mat对内存泄露的分析、jhat之二--结合jmap生成的dump结果在浏览器上展示
目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...
- JAVA内存模型(Java Memory Model ,JMM)
http://blog.csdn.net/hxpjava1/article/details/55189077 JVM有主内存(Main Memory)和工作内存(Working Memory),主内存 ...
- 死磕 java同步系列之JMM(Java Memory Model)
简介 Java内存模型是在硬件内存模型上的更高层的抽象,它屏蔽了各种硬件和操作系统访问的差异性,保证了Java程序在各种平台下对内存的访问都能达到一致的效果. 硬件内存模型 在正式讲解Java的内存模 ...
- Understanding Java Memory Model-理解java内存模型(JVM)
from https://medium.com/platform-engineer/understanding-java-memory-model-1d0863f6d973 Understanding ...
随机推荐
- SQL server基本操作(一)
--1.create database CREATE DATABASE MyDB GO --2.use database USE MyDB GO --3.create table CREATE T ...
- Fragstats景观分析研究
QQ 交流群: Fragstats景观分析 加群链接:http://url.cn/N4wZ3N
- POJ 2287 Tian Ji -- The Horse Racing(贪心)
题意:田忌和齐王有n匹马,进行n局比赛,每局比赛输者给胜者200,问田忌最多能得多少钱. 分析:如果田忌最下等的马比齐王最下等的马好,是没必要拿最下等的马和齐王最好的马比的.(最上等马同理) 因此,如 ...
- 3月3日(5) Roman to Integer
原题 Roman to Integer 题意很简单,把Roman字母翻译成int. 实现方式也不难,针对每个字符转成int,从右往左,依次判断,如果当前值比上一个值大则相加,小则相减. 什么,你问我怎 ...
- noip2006T1 能量项链
最近一直在做noip的题,由于太水一直没有写题解,可是这道题,这道题.啊啊啊啊…… 明明水的要命,调了一节课啊!!我干脆不要搞OI了啊! 特别逗比的错误啊!!!! 代码: #include <c ...
- Windows 8.1 序列化与反序列化
/// <summary> /// 对象序列化成 XML String /// </summary> public static void XmlSerialize<T& ...
- android的入门学习
android 入门学习. 活动:就是一个包含应用程序的用户界面的窗口.目的就是与用户交互. 意图:就是能够将来自不同应用程序的不同活动无缝连接在一起工作的"胶水",确保这些任务执 ...
- [译]Redis大冒险
原文:ALCA in Redis-land 一篇对使用Redis在NoSQL的世界中冒险之旅的总结. The legs of our journey 像每次出发一样,先对我们这次的旅程路线做个介绍: ...
- Delphi XE5教程5:程序的结构和语法
内容源自Delphi XE5 UPDATE 2官方帮助<Delphi Reference>,本人水平有限,欢迎各位高人修正相关错误! 也欢迎各位加入到Delphi学习资料汉化中来,有兴趣者 ...
- Hive内表和外表的区别
本文以例子的形式介绍一下Hive内表和外表的区别.例子共有4个:不带分区的内表.带分区的内表.不带分区的外表.带分区的外表. 1 不带分区的内表 #创建表 create table innerTabl ...