java对象内存分配验证

对象在Eden区分配内存

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
/**
* 对象优先在eden区域分配
* -verbose:gc:在控制台输出gc情况
* -Xms20M -Xmx20M:设置堆的大小
* -Xmn10M:设置新生代大小10M
* -XX:+PrintGCDetails“:打印GC详细信息
* -XX:SurvivorRatio=8:定义了新生代中Eden区域和Survivor区域(From幸存区或To幸存区)的比例
*
* 启动参数: -verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8
*
*/
public class EdenAllocateTest {

//这边定义一个1MB的对象
private static final int _1MB = 1024 * 1024;

public static void main(String[] args) {
//512K
byte[] arr1 = new byte[_1MB / 2];
System.out.println("1-----------------");
}
}


/**===================================运行结果===================================*/

1-----------------
Heap
//新生区
PSYoungGen total 9216K, used 2692K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
//Eden 被使用32%
eden space 8192K, 32% used [0x00000000ff600000,0x00000000ff8a1188,0x00000000ffe00000)
from space 1024K, 0% used [0x00000000fff00000,0x00000000fff00000,0x0000000100000000)
to space 1024K, 0% used [0x00000000ffe00000,0x00000000ffe00000,0x00000000fff00000)
ParOldGen total 10240K, used 0K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
object space 10240K, 0% used [0x00000000fec00000,0x00000000fec00000,0x00000000ff600000)
Metaspace used 3340K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 364K, capacity 388K, committed 512K, reserved 1048576K

验证大的对象直接进入老年代

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
/**
* 验证大对象直接进入老年代
* -XX:+UseSerialGC:新生代和老年代使用串行回收器
* -XX:PretenureSizeThreshold=5M:大于5M这个值的参数直接在老年代分配。
*
* 启动参数: -XX:+UseSerialGC -verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:PretenureSizeThreshold=5M
*
* 只对Serial与ParNew垃圾收集器有效
*/

public class LargeObjectAllocate {

private static final int _1MB = 1024 * 1024;

public static void main(String[] args) {
System.out.println(String.format("Allocate 【%dMB】, 【%dKB】 space", 6, 6 * 1024));
//定义6MB对象,直接在老年代中分配内存
byte[] bytes = new byte[6 * _1MB];
System.out.println(String.format("End allocate 【%dMB】, 【%dKB】 space", 6, 6 * 1024));

}
}

/**===================================运行结果===================================*/

Allocate 【6MB】, 【6144KB】 space
End allocate 【6MB】, 【6144KB】 space
Heap
def new generation total 9216K, used 3037K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
eden space 8192K, 37% used [0x00000000fec00000, 0x00000000feef7538, 0x00000000ff400000)
from space 1024K, 0% used [0x00000000ff400000, 0x00000000ff400000, 0x00000000ff500000)
to space 1024K, 0% used [0x00000000ff500000, 0x00000000ff500000, 0x00000000ff600000)
//老年代被使用6144K,差不多6MB的样子
tenured generation total 10240K, used 6144K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
the space 10240K, 60% used [0x00000000ff600000, 0x00000000ffc00010, 0x00000000ffc00200, 0x0000000100000000)
Metaspace used 3917K, capacity 4642K, committed 4864K, reserved 1056768K
class space used 435K, capacity 462K, committed 512K, reserved 1048576K

验证元空间OOM溢出

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
/**
* 验证元空间溢出
*
* -XX:MetaspaceSize=10m -XX:MaxMetaspaceSize=10m:设置元空间大小
* 启动参数: -XX:MetaspaceSize=10m -XX:MaxMetaspaceSize=10m
*
*/


public class MetaspaceOOM {

public static void main(String[] args) {
//获取当前JVM的类加载信息
ClassLoadingMXBean loadingMXBean = ManagementFactory.getClassLoadingMXBean();
while(true) {
//Enhancer是cglib中使用频率很高的一个类,它是一个字节码增强器,可以用来为无接口的类创建代理
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(MetaspaceOOM.class);
enhancer.setCallbackTypes(new Class[]{Dispatcher.class, MethodInterceptor.class});
enhancer.setCallbackFilter(new CallbackFilter() {

@Override
public int accept(Method method) {
return 1;
}

@Override
public boolean equals(Object obj) {
return super.equals(obj);
}
});

Class clazz = enhancer.createClass();
System.out.println(clazz.getName());
//显示数量信息(共加载过的类型数目,当前还有效的类型数目,已经被卸载的类型数目)
System.out.println("total: " + loadingMXBean.getTotalLoadedClassCount());
System.out.println("active: " + loadingMXBean.getLoadedClassCount());
System.out.println("unloaded: " + loadingMXBean.getUnloadedClassCount());
}

}
}

/**===================================运行结果===================================*/

allocate.MetaspaceOOM$$EnhancerByCGLIB$$4837d5cd
total: 1204
active: 1204
unloaded: 0
Exception in thread "main" net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at allocate.MetaspaceOOM.main(MetaspaceOOM.java:44)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
... 3 more
//元空间溢出
Caused by: java.lang.OutOfMemoryError: Metaspace
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
... 8 more

栈溢出验证

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
public class StackOverflowTest {

private static int deep = 0;

public static void main(String[] args) {
try {
recursive();
} catch (Throwable t) {
t.printStackTrace();
}
System.out.println("执行了:" + deep + "次");
}

//不断递归调用
private static void recursive(){
deep++;
recursive();
}
}

/**===================================运行结果===================================*/

...前省略
//显示栈溢出
at allocate.StackOverflowTest.recursive(StackOverflowTest.java:19)
at allocate.StackOverflowTest.recursive(StackOverflowTest.java:19)
at allocate.StackOverflowTest.recursive(StackOverflowTest.java:19)
at allocate.StackOverflowTest.recursive(StackOverflowTest.java:19)
//总共递归调用了26269次
执行了:26269

堆溢出验证

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
/**
* -Xmx10m -Xms10m
*/

public class StringOOMTest {
public static void main(String[] args) {
try {
List<String> list = new ArrayList<>();
for(int i = 0;; i++) {
System.out.println(i);
//JDK1.7常量池迁移到堆中,这里我们不断地在常量池中创建引用
//这里的intern方法可以去多了解一下
list.add(("String" + i++).intern());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

/**===================================运行结果===================================*/
...前省略
213420
//堆空间溢出
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3210)
at java.util.Arrays.copyOf(Arrays.java:3181)
at java.util.ArrayList.grow(ArrayList.java:265)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:239)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:231)
at java.util.ArrayList.add(ArrayList.java:462)
at allocate.StringOOMTest.main(StringOOMTest.java:17)

验证长期存在的对象进入老年代

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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/**
* 长期存活的对象进入老年代
*
* XX:MaxTenuringThreshold=3:设置年龄阈值,对象在Eden出生如果经第一次Minor GC后仍然存活, 且能被Survivor容纳的话, 将被移动到Survivor空间中, 并将年龄设为1. 以后对象在Survivor区中每熬过一次Minor GC年龄就+1. 当增加到设置的阀值时将会晋升到老年代。
* -XX:+PrintTenuringDistribution:JVM 在每次新生代GC时,打印出幸存区中对象的年龄分布。
* -XX:+PrintHeapAtGC:输出程序运行前后对的概况
* 启动参数: -verbose:gc -Xms40M -Xmx40M -Xmn20M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=3 -XX:+PrintTenuringDistribution -XX:+UseSerialGC -XX:+PrintHeapAtGC
*/

public class TenuringTest {

public static void main(String[] args) throws Exception {

byte[] arr1 = AllocateUtil.allocate256KB();
AllocateUtil.allocate8MB();
System.out.println("\n");

System.in.read();
System.out.println("1111=========");
AllocateUtil.allocate8MB();
byte[] arr2 = AllocateUtil.allocate512KB();
System.out.println("\n");

System.in.read();
System.out.println("22222=============");
AllocateUtil.allocate8MB();
byte[] arr3 = AllocateUtil.allocate256KB();
System.out.println("\n");

System.in.read();
System.out.println("3333=============");
AllocateUtil.allocate8MB();
byte[] arr4 = AllocateUtil.allocate512KB();
System.out.println("\n");

System.in.read();
System.out.println("4444=============");
AllocateUtil.allocate8MB();
byte[] arr5 = AllocateUtil.allocate256KB();
System.out.println("\n");

System.in.read();
System.out.println("55555=============");
AllocateUtil.allocate8MB();
byte[] arr6 = AllocateUtil.allocate512KB();
System.out.println("\n");

System.in.read();
System.out.println("6666=============");
AllocateUtil.allocateMB(8);
}

}
class AllocateUtil {

private static final int _1KB = 1024;

private static final int _1MB = _1KB * 1024;

public static byte[] allocate8MB() {
return allocateMB(8);
}

public static byte[] allocateMB(int mb) {
System.out.println(String.format("Allocate 【%dMB】, 【%dKB】 space", mb, mb * 1024));
byte[] bytes = new byte[mb * _1MB];
System.out.println(String.format("End allocate 【%dMB】, 【%dKB】 space", mb, mb * 1024));
return bytes;
}

public static byte[] allocateKB(int kb) {
System.out.println(String.format("Allocate 【%dKB】 space", kb));
return new byte[kb * _1KB];
}


public static byte[] allocate256KB() {
return allocateKB(256);
}

public static byte[] allocate512KB() {
return allocateKB(512);
}
}

/**===================================运行结果===================================*/

Allocate 【256KB】 space
Allocate 【8MB】, 【8192KB】 space
End allocate 【8MB】, 【8192KB】 space

1111=========
Allocate 【8MB】, 【8192KB】 space
{Heap before GC invocations=0 (full 0):
def new generation total 18432K, used 12409K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
//创建对象在Eden区
eden space 16384K, 75% used [0x00000000fd800000, 0x00000000fe41e698, 0x00000000fe800000)
from space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
tenured generation total 20480K, used 0K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 0% used [0x00000000fec00000, 0x00000000fec00000, 0x00000000fec00200, 0x0000000100000000)
Metaspace used 3779K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
[GC (Allocation Failure) [DefNew
Desired survivor size 1048576 bytes, new threshold 1 (max 3)
//1130720 / 1024 = 1028K岁数为1
- age 1: 1130720 bytes, 1130720 total
: 12409K->1104K(18432K), 0.0013928 secs] 12409K->1104K(38912K), 0.0014149 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=1 (full 0):
def new generation total 18432K, used 1104K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 0% used [0x00000000fd800000, 0x00000000fd800000, 0x00000000fe800000)
from space 2048K, 53% used [0x00000000fea00000, 0x00000000feb140e0, 0x00000000fec00000)
to space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
tenured generation total 20480K, used 0K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 0% used [0x00000000fec00000, 0x00000000fec00000, 0x00000000fec00200, 0x0000000100000000)
Metaspace used 3779K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
}
End allocate 【8MB】, 【8192KBspace
Allocate 【512KBspace

22222=============
Allocate 【8MB】, 【8192KB】 space
{Heap before GC invocations=1 (full 0):
def new generation total 18432K, used 10450K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 57% used [0x00000000fd800000, 0x00000000fe120960, 0x00000000fe800000)
from space 2048K, 53% used [0x00000000fea00000, 0x00000000feb140e0, 0x00000000fec00000)
to space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
tenured generation total 20480K, used 0K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 0% used [0x00000000fec00000, 0x00000000fec00000, 0x00000000fec00200, 0x0000000100000000)
Metaspace used 3779K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
[GC (Allocation Failure) [DefNew
Desired survivor size 1048576 bytes, new threshold 3 (max 3)
//524384 / 1024 = 512岁数为1
- age 1: 524384 bytes, 524384 total
: 10450K->512K(18432K), 0.0012789 secs] 10450K->1540K(38912K), 0.0012954 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=2 (full 0):
def new generation total 18432K, used 512K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 0% used [0x00000000fd800000, 0x00000000fd800000, 0x00000000fe800000)
from space 2048K, 25% used [0x00000000fe800000, 0x00000000fe880060, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
//之前的对象以及进入老年代了
tenured generation total 20480K, used 1028K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 5% used [0x00000000fec00000, 0x00000000fed01110, 0x00000000fed01200, 0x0000000100000000)
Metaspace used 3779K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
}
End allocate 【8MB】, 【8192KBspace
Allocate 【256KBspace

3333=============
Allocate 【8MB】, 【8192KB】 space
{Heap before GC invocations=2 (full 0):
def new generation total 18432K, used 9016K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 51% used [0x00000000fd800000, 0x00000000fe04e2e8, 0x00000000fe800000)
from space 2048K, 25% used [0x00000000fe800000, 0x00000000fe880060, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
tenured generation total 20480K, used 1028K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 5% used [0x00000000fec00000, 0x00000000fed01110, 0x00000000fed01200, 0x0000000100000000)
Metaspace used 3780K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
[GC (Allocation Failure) [DefNew
Desired survivor size 1048576 bytes, new threshold 3 (max 3)
//524384 / 1024 = 512岁数为2
//262240 / 1024 = 256岁数为1
- age 1: 262240 bytes, 262240 total
- age 2: 524384 bytes, 786624 total
: 9016K->768K(18432K), 0.0016583 secs] 10045K->1796K(38912K), 0.0016733 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=3 (full 0):
def new generation total 18432K, used 768K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 0% used [0x00000000fd800000, 0x00000000fd800000, 0x00000000fe800000)
from space 2048K, 37% used [0x00000000fea00000, 0x00000000feac00c0, 0x00000000fec00000)
to space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
tenured generation total 20480K, used 1028K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 5% used [0x00000000fec00000, 0x00000000fed01110, 0x00000000fed01200, 0x0000000100000000)
Metaspace used 3780K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
}
End allocate 【8MB】, 【8192KBspace
Allocate 【512KBspace

4444=============
Allocate 【8MB】, 【8192KB】 space
{Heap before GC invocations=3 (full 0):
def new generation total 18432K, used 9786K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 55% used [0x00000000fd800000, 0x00000000fe0ce760, 0x00000000fe800000)
from space 2048K, 37% used [0x00000000fea00000, 0x00000000feac00c0, 0x00000000fec00000)
to space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
tenured generation total 20480K, used 1028K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 5% used [0x00000000fec00000, 0x00000000fed01110, 0x00000000fed01200, 0x0000000100000000)
Metaspace used 3781K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
[GC (Allocation Failure) [DefNew
Desired survivor size 1048576 bytes, new threshold 3 (max 3)
//524384 / 1024 = 512岁数为3
//262240 / 1024 = 256岁数为2
//524384 / 1024 = 512岁数为1
- age 1: 524384 bytes, 524384 total
- age 2: 262240 bytes, 786624 total
- age 3: 524384 bytes, 1311008 total
: 9786K->1280K(18432K), 0.0005653 secs] 10814K->2308K(38912K), 0.0005804 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=4 (full 0):
def new generation total 18432K, used 1280K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 0% used [0x00000000fd800000, 0x00000000fd800000, 0x00000000fe800000)
from space 2048K, 62% used [0x00000000fe800000, 0x00000000fe940120, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
tenured generation total 20480K, used 1028K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 5% used [0x00000000fec00000, 0x00000000fed01110, 0x00000000fed01200, 0x0000000100000000)
Metaspace used 3781K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
}
End allocate 【8MB】, 【8192KBspace
Allocate 【256KBspace

55555=============
Allocate 【8MB】, 【8192KB】 space
{Heap before GC invocations=4 (full 0):
def new generation total 18432K, used 9790K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 51% used [0x00000000fd800000, 0x00000000fe04f818, 0x00000000fe800000)
from space 2048K, 62% used [0x00000000fe800000, 0x00000000fe940120, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
tenured generation total 20480K, used 1028K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 5% used [0x00000000fec00000, 0x00000000fed01110, 0x00000000fed01200, 0x0000000100000000)
Metaspace used 3781K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
[GC (Allocation Failure) [DefNew
Desired survivor size 1048576 bytes, new threshold 3 (max 3)
//同上
- age 1: 262240 bytes, 262240 total
- age 2: 524384 bytes, 786624 total
- age 3: 262240 bytes, 1048864 total
: 9790K->1024K(18432K), 0.0008305 secs] 10818K->2564K(38912K), 0.0008514 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=5 (full 0):
def new generation total 18432K, used 1024K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 0% used [0x00000000fd800000, 0x00000000fd800000, 0x00000000fe800000)
from space 2048K, 50% used [0x00000000fea00000, 0x00000000feb00120, 0x00000000fec00000)
to space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
tenured generation total 20480K, used 1540K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 7% used [0x00000000fec00000, 0x00000000fed81170, 0x00000000fed81200, 0x0000000100000000)
Metaspace used 3781K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
}
End allocate 【8MB】, 【8192KBspace
Allocate 【512KBspace

6666=============
Allocate 【8MB】, 【8192KB】 space
{Heap before GC invocations=5 (full 0):
def new generation total 18432K, used 10045K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 55% used [0x00000000fd800000, 0x00000000fe0cf4e0, 0x00000000fe800000)
from space 2048K, 50% used [0x00000000fea00000, 0x00000000feb00120, 0x00000000fec00000)
to space 2048K, 0% used [0x00000000fe800000, 0x00000000fe800000, 0x00000000fea00000)
tenured generation total 20480K, used 1540K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 7% used [0x00000000fec00000, 0x00000000fed81170, 0x00000000fed81200, 0x0000000100000000)
Metaspace used 3782K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
[GC (Allocation Failure) [DefNew
Desired survivor size 1048576 bytes, new threshold 3 (max 3)
- age 1: 524384 bytes, 524384 total
- age 2: 262240 bytes, 786624 total
- age 3: 524384 bytes, 1311008 total
: 10045K->1280K(18432K), 0.0004927 secs] 11585K->3076K(38912K), 0.0005076 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=6 (full 0):
def new generation total 18432K, used 1280K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 0% used [0x00000000fd800000, 0x00000000fd800000, 0x00000000fe800000)
from space 2048K, 62% used [0x00000000fe800000, 0x00000000fe940120, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
tenured generation total 20480K, used 1796K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 8% used [0x00000000fec00000, 0x00000000fedc11d0, 0x00000000fedc1200, 0x0000000100000000)
Metaspace used 3782K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 411K, capacity 434K, committed 512K, reserved 1048576K
}
End allocate 【8MB】, 【8192KBspace
Heap
def new generation total 18432K, used 10120K [0x00000000fd800000, 0x00000000fec00000, 0x00000000fec00000)
eden space 16384K, 53% used [0x00000000fd800000, 0x00000000fe0a20e0, 0x00000000fe800000)
from space 2048K, 62% used [0x00000000fe800000, 0x00000000fe940120, 0x00000000fea00000)
to space 2048K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000fec00000)
tenured generation total 20480K, used 1796K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 8% used [0x00000000fec00000, 0x00000000fedc11d0, 0x00000000fedc1200, 0x0000000100000000)
Metaspace used 3788K, capacity 4670K, committed 4864K, reserved 1056768K
class space used 412K, capacity 434K, committed 512K, reserved 1048576K
Disconnected from the target VM, address: '127.0.0.1:50446', transport: 'socket'

Process finished with exit code 0