jps 查看进行id
jps
jmap 查看细节
jmap -histo 11500
测试案例
package jvm;
import java.util.concurrent.TimeUnit;
public class YaoYi {
public static void main(String[] args) throws InterruptedException {
long starTimes = System.currentTimeMillis();
for (int i = 0; i < 500000; i++) {
test1();
}
long end = System.currentTimeMillis();
System.out.println("共计使用时间树:"+(end - starTimes));
// 保持活性,避免执行完成,线程结束,栈内存释放
TimeUnit.SECONDS.sleep(5000);
}
public static Student test1(){
Student student = new Student();
return student;
}
}
class Student{
private String name;
private int age;
}