转自: 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的更多相关文章

  1. jmap命令(Java Memory Map)(转)

    JDK内置工具使用 一.javah命令(C Header and Stub File Generator) 二.jps命令(Java Virtual Machine Process Status To ...

  2. Java Memory Management(1)

    Java Memory Management, with its built-in garbage collection, is one of the language’s finest achiev ...

  3. 当我们在谈论JMM(Java memory model)的时候,我们在谈论些什么

    前面几篇中,我们谈论了synchronized.final以及voilate的用法和底层实现,都绕不开一个话题-Java内存模型(java memory model,简称JMM).Java内存模型是保 ...

  4. 并发研究之Java内存模型(Java Memory Model)

    Java内存模型JMM java内存模型定义 上一遍文章我们讲到了CPU缓存一致性以及内存屏障问题.那么Java作为一个跨平台的语言,它的实现要面对不同的底层硬件系统,设计一个中间层模型来屏蔽底层的硬 ...

  5. java学习:JMM(java memory model)、volatile、synchronized、AtomicXXX理解

    一.JMM(java memory model)内存模型 从网上淘来二张图: 上面这张图说的是,在多核CPU的系统中,每个核CPU自带高速缓存,然后计算机主板上也有一块内存-称为主内(即:内存条).工 ...

  6. 五、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 ...

  7. JAVA内存模型(Java Memory Model ,JMM)

    http://blog.csdn.net/hxpjava1/article/details/55189077 JVM有主内存(Main Memory)和工作内存(Working Memory),主内存 ...

  8. 死磕 java同步系列之JMM(Java Memory Model)

    简介 Java内存模型是在硬件内存模型上的更高层的抽象,它屏蔽了各种硬件和操作系统访问的差异性,保证了Java程序在各种平台下对内存的访问都能达到一致的效果. 硬件内存模型 在正式讲解Java的内存模 ...

  9. Understanding Java Memory Model-理解java内存模型(JVM)

    from https://medium.com/platform-engineer/understanding-java-memory-model-1d0863f6d973 Understanding ...

随机推荐

  1. jQuery 手风琴侧边菜单

    动手做了一个简单手风琴菜单,上图: 点击 B 可收缩 C 列表,点击 C 改变自身和父节点 B 的样式,悬浮时均有不同的样式改变. 先看页面代码,列表的嵌套: <div id="men ...

  2. Populating Next Right Pointers in Each Node II

    题目地址: https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/ 关键思路:讲节点的左右子节 ...

  3. How to Fix Missing TortoiseSVN File Status Icons in Windows

    For many Windows-based developers, Subversion and TortoiseSVN is a great source control solution. It ...

  4. xml_editor

    概要 该工程是用来操作xml, 目的是为了在程序中操作xml中各类节点更加简单, 下面按照 工程简介, 库内部实现, 库接口使用, xml工具使用, xpath简介 几个部分来介绍该c++库. 工程简 ...

  5. 合并大量txt文件的内容

    首先熟悉一个dos命令 显示文件内容命令——type命令 1.格式:type [盘符:] [路径] 文件名 2.类型:内部命令 3.功能:把指定的文件内容在屏幕上显示或打印机输出,它常用作查阅和显示文 ...

  6. 锋利的jquery-选择器

    1 jquery $(document).ready(function(){}) 可以简写成 $(function(){})   2 jquery 对象和DOM对像 ① jquery对象和DOM对象不 ...

  7. 跟着PHP100第一季学写一个CMS(11-20)

    PS.刚发现IE并不兼容,有点悲剧  cms1.1密码处理 1.小知识:sha1($_answer) //加密为40位,不知道能不能破解 2.小知识:mysql_real_escape_string( ...

  8. 我的第一个MVC4程序

    InputExtensions 方法解释 http://blog.csdn.net/cnceohjm/article/details/8936669 https://msdn.microsoft.co ...

  9. 获取枚举Description的Name

    /// <summary> /// 获取枚举Description的Name /// </summary> /// <param name="enumName& ...

  10. CSS练习

    看到一个CSS参考手册:http://css.doyoe.com/ 感谢感谢!