-
Notifications
You must be signed in to change notification settings - Fork 3
/
shallowretainedheap.html
69 lines (57 loc) · 3.38 KB
/
shallowretainedheap.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="DITA-OT" /><meta name="DC.type" content="concept" />
<meta name="DC.title" content="Shallow vs. Retained Heap" />
<meta name="copyright" content="Copyright (c) 2008, 2023 SAP AG, IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ " type="primary" />
<meta name="DC.rights.owner" content="Copyright (c) 2008, 2023 SAP AG, IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ " type="primary" />
<meta name="DC.format" content="XHTML" />
<meta name="DC.identifier" content="concept_shallowretainedsize" />
<meta name="DC.language" content="en-us" />
<link rel="stylesheet" type="text/css" href="../styles/commonltr.css" />
<title>Shallow vs. Retained Heap</title>
</head>
<body id="concept_shallowretainedsize">
<h1 class="title topictitle1" id="ariaid-title1">Shallow vs. Retained Heap</h1>
<div class="body conbody">
<p class="p">
<strong class="ph b">Shallow heap</strong>
is the memory consumed by one object. An object needs 32 or 64 bits
(depending on the OS architecture) per reference, 4 bytes per
Integer, 8 bytes per Long, etc. Depending on the heap dump format the
size may be adjusted (e.g. aligned to 8, etc...) to model better the
real consumption of the VM.
</p>
<p class="p">
<strong class="ph b">Retained set</strong>
of X is the set of objects which would be removed by GC when X is garbage
collected.
</p>
<p class="p">
<strong class="ph b">Retained heap</strong>
of X is the sum of shallow sizes of all objects in the retained set
of X, i.e. memory kept alive by X.
</p>
<p class="p">Generally speaking, shallow heap of an object is its size
in the heap and retained size of the same object is the amount of
heap memory that will be freed when the object is garbage collected.
</p>
<p class="p">The retained set for a leading set of objects, such as all
objects of a particular class or all objects of all classes loaded by
a particular class loader or simply a bunch of arbitrary objects, is
the set of objects that is released if all objects of that leading
set become unaccessible. The retained set includes these objects as
well as all other objects only accessible through these objects. The
retained size is the total heap size of all objects contained in the
retained set.</p>
<img class="image" src="../mimes/62ff1436.png" alt="Example object graph" />
<p class="p">The Minimum Retained Size gives a good (under)estimation of the
retained size which is calculated ways faster than the
exact retained size of a set of objects. It only depends on the
number of objects in the inspected set, not the number of objects in
the heap dump.</p>
</div>
</body>
</html>