Home > Archives > JVM HeapTest

JVM HeapTest

Publish:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.ArrayList;

public class HeapTest {

    byte[] a = new byte[1024 * 100];  //100KB

    public static void main(String[] args) throws InterruptedException {
        ArrayList<HeapTest> heapTest = new ArrayList<>();
        while (true) {
            heapTest.add(new HeapTest());
            Thread.sleep(10);
        }

    }
}



1
2
3
4
baoguo@MacBook-Pro java % jvisualvm

如果visualGC插件没有安装就自己安装一下

声明: 本文采用 BY-NC-SA 授权。转载请注明转自: Ding Bao Guo