运行个JAVA 用sleep去hold住
package org.hjb.test;
public class TestOnly {
public static void main(String[] args) {
System.out.println("sleep ..");
try {
Thread.sleep(10000000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
java -Xmx10m -Xms10m org/hjb/test/TestOnly
从Jvm进程的角度观察
查看JAVA进程的总体内存大小
原始参数 java -Xmx10m -Xms10m org/hjb/test/TestOnly 后观察结果:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
root S 0.0 1.0 :00.27 java
变换参数 java -Xmx1024m -Xms1024m org/hjb/test/TestOnly 后观察
27278 root 20 0 2258424 31656 13776 S 0.0 0.8 0:00.16 java
继续变换参数 java -Xmx