搜索
您的当前位置:首页正文

JVM再体验:JVM可视化监控工具

来源:意榕旅游网
JVM再体验:JVM可视化监控工具

jdk -->bin里有

在cmd中输入:jconsole就启动了

这个程序实际的代码是在lib-->tools.jar里

jps:

选本地进程,点进去可以看到


测试:
import java.util.ArrayList;
import java.util.List;


import javax.swing.Box.Filler;


public class JconsoleTest {
	public byte[] b1 = new byte[128*1024];
	//测试内存的变化情况
	public static void main(String[] args) {
		try {
			Thread.sleep(5000);//为了能看到效果
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("start..");
		fill(1000);
	}


	public static void fill(int n) {
		List<JconsoleTest> jlist = new ArrayList<>();
		for(int i = 0; i < n; i++){
			try {
				Thread.sleep(100);//为了能看到效果
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			jlist.add(new JconsoleTest());
		}
		
	}
}

因篇幅问题不能全部显示,请点此查看更多更全内容

Top