zoukankan      html  css  js  c++  java
  • 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.
  • 相关阅读:
    Dual Quaternion Knowledge Graph Embeddings——对偶四元数知识图谱嵌入
    Python argparse模块
    Pythonvirtualenv创建虚拟环境
    KBGAN:用于知识图谱嵌入的对抗学习
    anaconda简单使用
    二分查找详解
    Quaternion Knowledge Graph Embeddings —— 基于四元数的知识图谱嵌入
    ConvR——用于多关系学习的自适应卷积模型
    Under Any Linux: install bypy tool
    PRUNE_BIND_MOUNTS="yes"不好用, 什么原因呢?
  • 原文地址:https://www.cnblogs.com/reynold-lei/p/3422531.html
Copyright © 2011-2022 走看看