`

Shallow and retained sizes

阅读更多

Reference from : http://www.yourkit.com/docs/java/help/sizes.jsp

 

YourKit Java Profiler is capable of measuring shallow and retained sizes of objects.

 

Shallow size of an object is the amount of memory allocated to store the object itself, not taking into account the referenced objects. Shallow size of a regular (non-array) object depends on the number and types of its fields. Shallow size of an array depends on the array length and the type of its elements (objects, primitive types). Shallow size of a set of objects represents the sum of shallow sizes of all objects in the set.

 

Retained size of an object is its shallow size plus the shallow sizes of the objects that are accessible, directly or indirectly, only from this object. In other words, the retained size represents the amount of memory that will be freed by the garbage collector when this object is collected.

 

To better understand the notion of the retained size, let us look at the following examples:

 

In order to measure the retained sizes, all objects in memory are treated as nodes of a graph where its edges represent references from objects to objects. There are also special nodes - GC root objects, which will not be collected by Garbage Collector at the time of measuring (read more about GC roots).

The pictures below show the same set of objects, but with varying internal references.

Figure 1:                                                       Figure 2:
  
 

Let us consider obj1.
As you can see, in both pictures we have highlighted all of the objects that are directly or indirectly accessed only by obj1. If you look at Figure 1, you will see that obj3 is not highlighted, because it is also referenced by a GC root object. On Figure 2, however, it is already included into the retained set, unlike obj5, which is still referenced by GC root.

 

Thus, the retained size of obj1 will represent the following respective values:

  • For Figure 1: the sum of shallow sizes of obj1, obj2 and obj4
  • For Figure 2: the sum of shallow sizes of obj1, obj2, obj3 and obj4

Looking at obj2, however, we see that its retained size in the above cases will be:

  • For Figure 1: the sum of shallow sizes of obj2 and obj4
  • For Figure 2: the sum of shallow sizes of obj2, obj3 and obj4

In general, retained size is an integral measure, which helps to understand the structure (сlustering) of memory and the dependencies between object subgraphs, as well as find potential roots of those subgraphs.

 

  • 大小: 4.5 KB
  • 大小: 3.9 KB
分享到:
评论

相关推荐

    Shallow and Deep Networks Intrusion Detection System A Taxonomy and Survey.pdf

    标题中的“Shallow and Deep Networks Intrusion Detection System: A Taxonomy and Survey”指向了文档探讨的核心,即浅层网络和深层网络在入侵检测系统(IDS)中的应用,并提出了一种分类法和调研。这一标题强调了对...

    A Shallow Introduction to Perl and Python

    A Shallow Introduction to Perl and Python

    shallow water equation c++ code

    this is a C++ code of shallow water equation

    高中英语单词天天记shallow素材

    此外,"His arguments seemed shallow and tedious." 提到的“shallow arguments”指的是缺乏深度和说服力的论点。 在搭配上,"shallow"可以与多种名词进行组合,形成如"shallow argument"(浅薄的论据)、"shallow...

    前端开源库-shallow-equals

    "shallow-equals" 是一个专门用于浅层比较的开源库,它为开发者提供了便捷的方式来判断两个数据结构是否在表面级别(即只检查第一层属性)上相同。这个库尤其适用于那些性能敏感的场景,例如在React组件的...

    Lattice-Boltzmann-Methods-for-Shallow-Water-Flows.pdf

    标题中的"Lattice-Boltzmann-Methods-for-Shallow-Water-Flows.pdf"指明了文档的主要内容是探讨用晶格玻尔兹曼方法(Lattice Boltzmann Method,简称LBM)来求解浅水流动方程。这个标题揭示了文档的研究领域和使用的...

    SHALLOW

    标题“SHALLOW”可能指的是一个特定的字体设计或者与字体设计相关的项目。在这个场景下,我们来深入探讨一下“字体”这一主题。 字体是视觉传达中的一个重要元素,它影响着信息的阅读性和感知效果。在计算机领域,...

    1D shallow water model

    ### 一维浅水模型(1D Shallow Water Model):溃坝问题的数值求解 一维浅水模型是流体力学中的一个重要工具,用于模拟河流、湖泊、海洋等自由表面流体的运动,特别是在洪水模拟、海岸工程、环境评估等领域有着广泛...

    SHALLOW LEARNING FOR DEEP NETWORKS.pdf

    标题《SHALLOW LEARNING FOR DEEP NETWORKS》表明,这篇文章探讨了如何利用浅层网络的特性来构建深层网络。浅层网络(例如具有一个隐藏层的监督学习网络)由于其结构简单,因此易于解释、分析和优化,但它们缺乏深层...

    Spatial-Phase Shallow Learning Rethinking Face Forgery Detection

    "Spatial-Phase Shallow Learning Rethinking Face Forgery Detection in Frequency Domain" 这篇论文聚焦于利用频域信息,特别是相位谱,来提升人脸识别伪造检测的性能。研究指出,大多数的人脸伪造技术都会涉及到...

    A simple finite volume method for the shallow water equations

    浅水方程是一组描述水体在水平面上流动的偏微分方程,广泛应用于水文模型、洪水波模拟以及溃坝等问题的研究。有限体积法是一种数值计算方法,用于对偏微分方程进行空间离散化处理,通过计算流体体积的平均值来求解...

    CM20315_Shallow.ipynb

    CM20315_Shallow.ipynb

    Foundation design and construction【M】Hong Kong SAR.pdf

    The scope of the publication is also expanded to cover the key design aspects for shallow foundations, in response to the request of the practitioners. Hence, a new publication title is used. The ...

    深度学习综述(英文)

    Shallow and Deep Learners are distinguished by the depth of their credit assignment paths, which are chains of possibly learnable, causal links between actions and effects. I review deep supervised ...

    Lax pair, Darboux transformation and soliton solutions for the (2+1)-dimensional generalization of shallow water wave equation

    (2+1)维广义浅水波方程的Lax对,Darbuox变换和孤子解,闻小永,高以天,利用奇异流形方法构造了(2+1)维广义浅水波方程的Lax和相关的Darbuox变换,通过使用得到的Darbuox变换,得到了该方程的一次和二次迭代解以及

    Big Data in Omics and Imaging: Association Analysis

    It represents the paradigm shift of genetic studies of complex diseases– from shallow to deep genomic analysis, from low-dimensional to high dimensional, multivariate to functional data analysis ...

    《The Pleasures of Pi, e and Other Interesting Numbers》作者: Adrian, Y. E.

    mathematicians and those who “hated math in school.” The book is organized into two sections: (I) Beauty for the Eye (shallow water for the non-swimmer); and (II) A Feast for the Mind (slowly ...

    Smart City and Green Growth

    based on technological orthodoxies which are conceptually and empirically shallow. The motivation behind this paper is to address the conceptual adolescence which relates to the wholesale ...

    shallow-backup:适用于 macOS 和 Linux 开发人员的 Git 集成备份工具

    shallow-backup可让您轻松创建已安装包、应用程序、字体和点文件的轻量级备份,并自动将它们推送到远程 Git 存储库。 内容 为什么? 我想要一个工具,可以让你: 从它们在系统上的位置备份点文件。 从系统上的...

Global site tag (gtag.js) - Google Analytics