Skip to content

Commit e2884f3

Browse files
committed
minorGC
1 parent 22676d0 commit e2884f3

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.crossoverjie.gc;
2+
3+
/**
4+
* Function: Eden区不够分配时,发生minorGC
5+
*
6+
* @author crossoverJie
7+
* Date: 17/01/2018 22:57
8+
* @since JDK 1.8
9+
*/
10+
public class MinorGC {
11+
12+
/**
13+
* 1M
14+
*/
15+
private static final int SIZE = 1024 * 1024 ;
16+
17+
public static void main(String[] args) {
18+
byte[] one ;
19+
byte[] four ;
20+
21+
one = new byte[2 * SIZE] ;
22+
23+
24+
//再分配一个 5M 内存时,Eden区不够了,
25+
four = new byte[5 * SIZE] ;
26+
}
27+
}

0 commit comments

Comments
 (0)