赞
踩
之前根据视频做的总结,备个份。
volatile是Java虚拟机提供的轻量级的同步机制。
三个特性:
保证可见性
线程修改了工作内存中的值并写回到主内存之后,主内存立刻通知所有线程。称为可见性。(结合JMM理解)
代码演示可见性+原子性代码
import java.util.concurrent.TimeUnit; /** * 1. 验证volatile可见性 * 1.1 假如number=0,number变量之前没有添加volatile关键字,没有可见性。 * * @author shiwenquan * @Create 2020-12-10 16:16 * @description */ public class VolatileDemo { public static void main(String[] args) { MyData myData = new MyData(); new Thread(() -> { System.out.println(Thread.currentThread().getName() + "\t come in"); //睡眠三秒 try {TimeUnit.SECONDS.sleep(3);} catch (InterruptedException e) {e.printStackTrace();} myData.addT060(); System.out.println(Thread.currentThread().getName() + "\t update number value: " + myData.number); }, "AAA").start(); // 第二个main线程 while (myData.number == 0) { // main线程一直在这里等待循环,直到number不等于0 // 如果不添加volatile关键字,会一直循环,因为此时没有可见性。 } System.out.println(Thread.currentThread().getName() + "\t minssion is over, main is value" + myData.number); } } class MyData { volatile int number = 0; public void addT060() { this.number = 60; } }
不保证原子性
volatile不保证原子性代码验证
/** * 1. 验证volatile可见性 * 1.1 假如number=0,number变量之前没有添加volatile关键字,没有可见性。 * 1.2 添加了volatile,可以解决可见性问题。 * * 2. 验证volatile不保证原子性 * 2.1 原子性指的是什么意思? * 不可分割,完整性。要么同时成功要么同时失败。 * 2.2 volatile不保证原子性案例。 * * @author shiwenquan * @Create 2020-12-10 16:16 * @description */ public class VolatileDemo { public static void main(String[] args) { MyData myData = new MyData(); for (int i = 0; i < 20; i++) { new Thread(() -> { for (int j = 0; j < 1000; j++) { myData.addPlusPlus(); } },String.valueOf(i)).start(); } // 需要等待所有线程计算完成之后,计算最终结果。 while (Thread.activeCount() > 2){ Thread.yield(); } System.out.println(Thread.currentThread().getName()+"\t number value: " + myData.number); } } class MyData { volatile int number = 0; // 此时number前面加了volatile public void addPlusPlus(){ number++; } }
禁止指令重排(指令重排结合JMM的有序性查看)
volatile实现禁止指令重排优化,从而避免多线程环境下程序出现乱序执行的现象。
是一种抽象概念并不真实存在,它描述是一组规则或规范,通过规范定义了程序中各个变量(包括实例字段,静态字段和构成数组对象的元素)的访问方式。
由于JVM运行程序的实体是线程,而每个线程创建时JVM都会为其创建一个工作内存(有些地方称为栈空间),工作内存是每个线程的私有数据区域,而Java内存模型中规定所有变量都存储在主内存,主内存是共享内存区域,所有线程都可访问,但线程对变量的操作(读取赋值等)必须在工作内存中进行,首先要将变量从主内存拷贝到自己的工作内存空间,然后对变量进行操作,操作完成后再将变量写回主内存。不能直接操作主内存中的变量,各个线程中的工作内存里存储着主内存中的变量副本拷贝,因此不同的线程间无法访问对方的工作内存,线程间的通信(传值)必须通过主内存来完成,其简要访问过程如下图:
JMM关于同步的规定:
特性:
可见性
原子性
有序性
计算机在执行程序时,为了提高性能,编译器和处理器常常会对指令做重排。一般分为一下3种。
| 源代码 | --> | 编译器优化的重排 | --> | 指令并行的重排 | --> | 内存系统的重排 | --> | 最终执行的指令 |
单线程环境里确保程序最终执行结果和代码顺序执行结果一致。
处理器在进行重排序时必须要考虑指令之间的数据依赖性。
多线程环境中线程交替执行,由于编译器优化重排的存在,两个线程中使用的变量能否保证一致性是无法确定的,结果无法预测。
问题实例代码,可以在getInstance()方法前加synchronized关键字来避免这个问题,但是synchronized直接加在方法上不推荐,效率会急剧降低。
/** * @author shiwenquan * @Create 2020-12-11 13:46 * @description */ public class SingletonDemo { private static SingletonDemo instance = null; private SingletonDemo(){ System.out.println(Thread.currentThread().getName() + "\t 构造方法。。"); } public static SingletonDemo getInstance(){ if (instance == null){ instance = new SingletonDemo(); } return instance; } public static void main(String[] args) { // 单线程 /* System.out.println(SingletonDemo.getInstance() == SingletonDemo.instance); System.out.println(SingletonDemo.getInstance() == SingletonDemo.instance); System.out.println(SingletonDemo.getInstance() == SingletonDemo.instance);*/ // 多线程并发 for (int i = 0; i < 10; i++) { new Thread(() -> { SingletonDemo.getInstance(); },String.valueOf(i)).start(); } } }
修正之后(DCL案例),为减少代码这里只贴getInstance()方法的代码:
DCL(双端检查)机制不一定安全,因为时有指令重排的存在,加入volatile可以禁止指令重排。
原因在于某一个线程执行到第一次检测,读取到的instance不为null时,instance的引用对象可能没有完成初始化。
instance = new SingletonDemo();可以分为3布完成(伪代码)
memory = allocate();//1.分配对象内存空间
instance(memory);//2.初始化对象
instance = memory;//3.设置instance指向刚分配的内存地址,此时instance!=null
2和3不存在数据依赖关系,而且无论重排前还是重排后程序的执行结果在单线程中没有改变,因此这种重排优化时允许的。
memory = allocate();//1.分配对象内存空间
instance = memory;//3.设置instance指向刚分配的内存地址,此时instance!=null,但是此时对象还没有初始化完成!
instance(memory);//2.初始化对象
但是指令重排只会保证串行语义执行的一致性(单线程),但并不会关心多线程间的语义一致性。
所以当一条线程访问instance不为null时,由于instance实例未必已经初始化完成,也就造成了线程安全问题。
// DCL(Double Check Lock双端检锁机制)
public static synchronized SingletonDemo getInstance(){
if (instance == null){
synchronized (SingletonDemo.class){
if (instance == null){
instance = new SingletonDemo();
}
}
}
return instance;
}
这样修改之后绝大部分情况都不会出现线程安全问题,并不绝对,因为编译里和处理器有可能做指令重排,重排之后可能还会出现创建多个对象的问题。volatile可以禁止指令重排,于是可以在变量前面用volatile关键字修饰。
最后代码:
/** * @author shiwenquan * @Create 2020-12-11 13:46 * @description */ public class SingletonDemo { private volatile static SingletonDemo instance = null; private SingletonDemo(){ System.out.println(Thread.currentThread().getName() + "\t 构造方法。。"); } // DCL(Double Check Lock双端检锁机制) public static synchronized SingletonDemo getInstance(){ if (instance == null){ synchronized (SingletonDemo.class){ if (instance == null){ instance = new SingletonDemo(); } } } return instance; } public static void main(String[] args) { // 单线程 /* System.out.println(SingletonDemo.getInstance() == SingletonDemo.instance); System.out.println(SingletonDemo.getInstance() == SingletonDemo.instance); System.out.println(SingletonDemo.getInstance() == SingletonDemo.instance);*/ // 多线程并发 for (int i = 0; i < 10; i++) { new Thread(() -> { SingletonDemo.getInstance(); },String.valueOf(i)).start(); } } }
全称Compare-And-Swap并比较并交换,它是CPU并发原语。
它的功能是判断内存某个位置的值是否为预期值,如果是则更改为新的值,这个过程是原子的。
CAS并发原语体现在Java语言中就是sun.misc.Unsafe类中的各个方法。调用Unsafe类中的CAS方法,JVM会帮我们实现出CAS汇编指令。这是一种完全依赖于硬件的功能,通过它实现原子操作。再次强调,由于CAS是一种系统原语,原语属于操作系统用语范畴,是由若干条指令组成的,用于完成某个功能的一个过程,并且原语的执行必须是连续的,在执行过程中不允许被中断,也就是说CAS是一条CPU的原子指令,不会造成所谓的数据不一致问题。
compareAndSet()
如果当前值==期望值,则以原子方式将该值设置为给定的更新值
参数:
期望值,更新值
返回值:
如果成功返回true,错误返回false
示例代码:
public static void main(String[] args) {
AtomicInteger atomicInteger = new AtomicInteger(5);
System.out.println(atomicInteger.compareAndSet(5, 2019)+ "\t update : " + atomicInteger.get());
System.out.println(atomicInteger.compareAndSet(5, 1024)+ "\t update : " + atomicInteger.get());
}
Unsafe是CAS的核心类,由于Java方法无法直接访问底层系统,需要通过本地(native)方法来访问,Unsafe相当于一个后门,基于该类可以直接操作特定内存的数据。Unsafe类存在于sun.misc包中,其内部方法操作可以像C的指针一样直接操作内存,因为Java中CAS操作的执行依赖于Unsafe类的方法。
注意:Unsafe类中的所有方法都是native修饰的,也就是说Unsafe类中的方法都是直接调用操作系统底层资源,执行相应任务。
变量valueOffset,表示该变量值在内存中的偏移地址,因为Unsafe就是根据内存偏移地址来获取数据的。
/**
* Atomically increments by one the current value.
*
* @return the previous value
*/
public final int getAndIncrement() {
return unsafe.getAndAddInt(this, valueOffset, 1);
}
变量value用volatile修饰,保证了多线程之间的内存可见性。
循环时间长开销大(do while)
只能保证一个共享变量的原子操作
当对一个共享变量执行操作时,可以使用CAS方式来保证原子操作,但是对多个共享变量操作时,循环CAS就无法保证操作的原子性,这个时候就需要锁来保证原子性。
ABA问题
假如有两个线程,线程一从内存位置V中取出A,这时候另一个线程二也从内存中取出A,并且线程二进行了一些操作将值变成了B,然后线程二又将V位置的数据变成A,这时候线程一进行CAS操作发现内存中仍是A,然后线程一操作成功。
尽管线程一的CAS操作成功,但是不代表这个过程就是没问题的。
原子引用
原子引用实例代码(无法避免ABA问题):
import java.util.concurrent.atomic.AtomicReference; class User { String userName; int age; public User(String userName, int age) { this.userName = userName; this.age = age; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "User{" + "userName='" + userName + '\'' + ", age=" + age + '}'; } } /** * @author shiwenquan * @Create 2020-12-14 9:28 * @description */ public class AtomicReferenceDemo { public static void main(String[] args) { User z3 = new User("z3", 22); User l4 = new User("l4", 23); AtomicReference<User> reference = new AtomicReference<>(); reference.set(z3); boolean b = reference.compareAndSet(z3, l4); System.out.println(b + "\t " + reference.get().toString()); } }
代码实例:
/** * 集合类不安全问题 * java.util.ConcurrentModificationException 异常 * @author shiwenquan * @Create 2020-12-14 10:11 * @description */ public class ContainerNotSageDemo { public static void main(String[] args) { /* List<String> list = new ArrayList<>(); List<String> list = new Vector<>(); List<String> list = Collections.synchronizedList(new ArrayList<>());*/ List<String> list = new CopyOnWriteArrayList<>(); list.add("1"); for (int i = 0; i < 30; i++) { new Thread(()->{ // java.util.ConcurrentModificationException 异常 list.add(UUID.randomUUID().toString().substring(0,8)); System.out.println(Thread.currentThread().getName()+list); },String.valueOf(i)).start(); } /** * 1.故障现象 * java.util.ConcurrentModificationException * * 2.导致原因 * 并发争抢修改导致,一个线程正在写,另一个线程来抢,导致数据不一致。 * * 3.解决方案 * 3.1 使用new Vector<>(); * 3.2 使用Collections.synchronizedList(new ArrayList<>()); * 3.3 使用new CopyOnWriteArrayList<>(); * * 4.优化建议 * 写时复制:CopyOnWrite容器即写时复制的容器。往一个容器添加元素的时候,不直接往当前容器Object[]添加,而是先将当前容器 * Object[]进行copy,复制出一个新的容器Object[] newElements,然后在新的容器Object[] newElements里添加元素,添加元素 * 之后再将原容器的引用指向新的容器 setArray(newElements)。这样做的好处是可以对CopyOnWrite容器进行并发读,而不需要加锁, * 因为当前容器不会添加任何元素。所以CopyOnWrite容器也是一种读写分离的思想。读和写不同的容器。 * * CopyOnWrite的add方法源码: * Appends the specified element to the end of this list. * @param e element to be appended to this list * @return {@code true} (as specified by {@link Collection#add}) * * public boolean add(E e) { * final ReentrantLock lock = this.lock; * lock.lock(); * try { * Object[] elements = getArray(); * int len = elements.length; * Object[] newElements = Arrays.copyOf(elements, len + 1); * newElements[len] = e; * setArray(newElements); * return true; * } finally { * lock.unlock(); * } * } */ }
实例代码:(错误和解决办法和List类似)
// Set<String> set = new HashSet<>();
// Set<String> set = Collections.synchronizedSet(new HashSet<>());
Set<String> set = new CopyOnWriteArraySet<>();
for (int i = 0; i < 30; i++) {
new Thread(()->{
// java.util.ConcurrentModificationException 异常
set.add(UUID.randomUUID().toString().substring(0,8));
System.out.println(Thread.currentThread().getName()+set);
},String.valueOf(i)).start();
}
实例代码:(用ConcurrentHashMap解决)
// Map<String,String> map = new HashMap<>();
// Map<String,String> map = Collections.synchronizedMap(new HashMap<>());
Map<String,String> map = new ConcurrentHashMap<>();
for (int i = 0; i < 30; i++) {
new Thread(()->{
// java.util.ConcurrentModificationException 异常
map.put(Thread.currentThread().getName(),UUID.randomUUID().toString().substring(0,8));
System.out.println(Thread.currentThread().getName()+map);
},String.valueOf(i)).start();
}
公平锁:指多个线程按照申请锁的顺序来获得锁。
非公平锁:指多个线程获取锁的顺序并不是按照申请锁的顺序,有可能后申请的线程比先申请的线程优先获取锁。在高并发的情况下,有可能会造成优先级反转或者饥饿现象。
指的是同一线程外层函数获得锁之后,内层递归函数仍能获取该锁的代码,在同一个线程在外层方法获取锁的时候,进入内层方法锁会自动获取锁。
也就说,线程可以进入任何一个它已经拥有的锁 所同步着的代码块。
ReentrantLock/Synchronized就是典型的可重入锁。
最大作用就是避免死锁。
可重入锁代码示例:
class Phone{ public synchronized void sendSMS() throws Exception{ System.out.println(Thread.currentThread().getId()+"\t sendSMS方法。。"); sendEmail(); } public synchronized void sendEmail() throws Exception{ System.out.println(Thread.currentThread().getId()+"\t sendEmail方法。。"); } } /** * @author shiwenquan * @Create 2020-12-14 14:50 * @description */ public class ReenterLockDemo { public static void main(String[] args) { Phone phone = new Phone(); for (int i = 0; i < 2; i++) { new Thread(()->{ try { phone.sendSMS(); } catch (Exception e) { e.printStackTrace(); } },String.valueOf(i)).start(); } /** * 输出: * 11 sendSMS方法。。 * 11 sendEmail方法。。 * 12 sendSMS方法。。 * 12 sendEmail方法。。 */ } }
独占:指该锁一次只能被一个线程所持有。ReentrantLock和Synchronized而言都是独占锁。
共享:指该锁可被多个线程所持有。对ReentrantReadWriteLock其读锁是共享锁,写锁是独占锁。读锁的共享锁可保证并发读是非常高效的,读写,写读,写写的过程是互斥的。
代码示例:
/** * 资源类 */ class MyCache{ private volatile Map<String, Object> map = new HashMap<>(); private ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); public void put(String key, Object value){ rwLock.writeLock().lock(); try { System.out.println(Thread.currentThread().getName()+"\t 正在写入:"+key); try { // 暂停线程一会 TimeUnit.MILLISECONDS.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } map.put(key,value); System.out.println(Thread.currentThread().getName()+"\t 写入完成。"); }catch (Exception e){ e.printStackTrace(); }finally { rwLock.writeLock().unlock(); } } public void get(String key){ rwLock.readLock().lock(); try { System.out.println(Thread.currentThread().getName()+"\t 正在读取。"); try { // 暂停线程一会 TimeUnit.MILLISECONDS.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } Object result = map.get(key); System.out.println(Thread.currentThread().getName()+"\t 读取完成:"+result); }catch (Exception e){ e.printStackTrace(); }finally { rwLock.readLock().unlock(); } } } /** * 多线程同时读一个资源类没有任何问题,所以为了满足并发量,读取共享资源应该可以同时进行。 * 但是如果有一个线程想去写共享资源,就不应该再有其他线程可以对该资源进行读或写。 * * 小总结: * 读-读 能共存 * 读-写 不能共存 * 写-写 不能共存 * * 写操作:原子+独占,中间整个过程必须是一个完整的统一体,中间不许被分割或者打断。 * * @author shiwenquan * @Create 2020-12-14 15:43 * @description */ public class ReadWriteLockDemo{ public static void main(String[] args) { MyCache myCache = new MyCache(); for (int i = 0; i < 5; i++) { final int tempInt = i; new Thread(()->{ myCache.put(tempInt+"", tempInt+""); },String.valueOf(i)).start(); } for (int i = 0; i < 5; i++) { final int tempInt = i; new Thread(()->{ myCache.get(tempInt+""); },String.valueOf(i)).start(); } } }
是指尝试获取锁的线程不会立即阻塞,而是采用循环的方式去尝试获取锁,这样的好处是减少线程上下文切换的消耗,缺点是循环会消耗CPU。
代码示例:
public class SpinLockDemo { AtomicReference<Thread> atomicReference = new AtomicReference<>(); public void myLook(){ Thread thread = Thread.currentThread(); // 自旋 while (!atomicReference.compareAndSet(null, thread)){ } System.out.println(thread.getName()+"获得锁。。"); } public void myUnLock(){ Thread thread = Thread.currentThread(); atomicReference.compareAndSet(thread, null); System.out.println(thread.getName()+"释放锁。。"); } public static void main(String[] args) throws InterruptedException { SpinLockDemo demo = new SpinLockDemo(); new Thread(()->{ demo.myLook(); try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } demo.myUnLock(); },"t1").start(); // 确保线程一先获得锁。 TimeUnit.SECONDS.sleep(2); new Thread(()->{ demo.myLook(); demo.myUnLock(); },"t2").start(); } }
CountDownLath
让一些线程阻塞直到另一些线程完成一系列操作后才被唤醒。
主要有两个方法,当一个或者多个线程调用await方法时,调用线程会被阻塞。其它线程调用countDown方法会将计数器减 1(调用countDown方法的线程不会阻塞),当计数器的值变为零时,因调用await方法被阻塞的线程会被唤醒,继续执行。
代码实例:
public class CountDownLatchDemo { public static void main(String[] args) { CountDownLatch latch = new CountDownLatch(6); for (int i = 0; i < 6; i++) { new Thread(()->{ System.out.println(Thread.currentThread().getName()+"\t 结束。"); latch.countDown(); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()+"\t 结束。。"); },String.valueOf(i)).start(); } try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()+"\t main结束。"); } }
注意结果(当计数器变成零时,不管线程是否已经结束,被阻塞的线程会被立即唤醒):
0 结束。
1 结束。
2 结束。
3 结束。
4 结束。
5 结束。
main main结束。
3 结束。。
5 结束。。
0 结束。。
1 结束。。
4 结束。。
2 结束。。
CyclicBarrier
CyclicBarrier的字面意思时可循环(Cyclic)使用的屏障(Barrier)。它要做的事情是让一组线程到达一个屏障(也可以叫同步点)时被阻塞,直到最后一个线程达到屏障时,屏障才会开门,所有被屏障拦截的线程才会继续干活,线程进入屏障通过CyclicBarrier的await()方法。
public class CyclicBarrierDemo { public static void main(String[] args) { CyclicBarrier barrier = new CyclicBarrier(7, ()->{ System.out.println("---------"); }); for (int i = 0; i < 7; i++) { final int tempInt = i; new Thread(()->{ System.out.println(Thread.currentThread().getName()+"\t 第" + tempInt + "个!"); try { barrier.await(); } catch (InterruptedException e) { e.printStackTrace(); } catch (BrokenBarrierException e) { e.printStackTrace(); } try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()+"\t 结束。。"); },String.valueOf(i)).start(); } } }
注意结果(和CountDownLath差不多,不管线程是否已经结束,被阻塞的线程会被立即唤醒):
0 第0个!
1 第1个!
2 第2个!
3 第3个!
4 第4个!
5 第5个!
6 第6个!
---------
0 结束。。
6 结束。。
5 结束。。
1 结束。。
2 结束。。
4 结束。。
3 结束。。
Semaphore
Semaphore(信号灯)主要有两个目的,一个用于多个共享资源的互斥使用,另一个用于并发线程数的控制。
代码示例:
public class SemaphoreDemo { public static void main(String[] args) { // 模拟三个停车位 Semaphore semaphore = new Semaphore(3); // 模拟六个汽车 for (int i = 0; i < 6; i++) { new Thread(()->{ try { semaphore.acquire(); System.out.println(Thread.currentThread().getName()+"\t 抢到车位。"); TimeUnit.SECONDS.sleep(3); System.out.println(Thread.currentThread().getName()+"\t 离开车位。"); } catch (InterruptedException e) { e.printStackTrace(); }finally { semaphore.release(); } },String.valueOf(i)).start(); } } }
阻塞队列:首先是一个队列,而一个阻塞队列在数据结构中所起的作用大致是,线程1往阻塞队列中添加元素,而线程2从阻塞队列中移除元素。
当阻塞队列是空时,从队列中获取元素的操作会被阻塞。
当队列是满的时候,往队列中添加元素的操作将会被阻塞。
有七种:
BlockingQueue核心方法:
方法类型 | 抛出异常 | 特殊值 | 阻塞 | 超时 |
---|---|---|---|---|
插入 | add(e) | offer(e) | put(e) | offer(e,time,unit) |
移除 | remove() | poll() | take() | poll(time,unit) |
检查 | element() | peek() | 不可用 | 不可用 |
抛出异常:
特殊值:
一直阻塞:
超时退出:
用在哪里?
- 生产者消费者模式
传统版代码示例:
/** * 题目:一个初始值为零的变量,两个线程交替操作,一个加1一个减一,来五次 * * 1. 线程 操作(方法) 资源类 * 2. 判断 干活 通知 * 3. 防止虚假唤醒机制 * * @author shiwenquan * @Create 2020-12-16 14:34 * @description */ public class ProdConsumer_TraditionDemo { private static int i = 0; public static void main(String[] args) throws InterruptedException { ShareData data = new ShareData(); new Thread(()->{ for (int j = 0; j < 5; j++) { data.decrement(); try { TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } } },"AA").start(); new Thread(()->{ for (int j = 0; j < 5; j++) { data.increment(); } },"BB").start(); } } class ShareData{ private int number; private Lock lock = new ReentrantLock(); private Condition condition = lock.newCondition(); // 加 public void increment() { lock.lock(); try { // 1. 判断 while (number != 0){ // 等待,不能生产 condition.await(); } // 2.干活 number++; System.out.println(Thread.currentThread().getName()+"\t "+number); // 3. 通知唤醒 condition.signal(); }catch (Exception e){ e.printStackTrace(); }finally { lock.unlock(); } } // 减 public void decrement() { lock.lock(); try { // 1. 判断 while (number == 0){ // 等待,不能生产 condition.await(); } // 2.干活 number--; System.out.println(Thread.currentThread().getName()+"\t "+number); // 3. 通知唤醒 condition.signal(); }catch (Exception e){ e.printStackTrace(); }finally { lock.unlock(); } } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
阻塞队列版代码示例:
/** * volatile/CAS/atomicInteger/blockQueue/线程交互/原子引用 * * @author shiwenquan * @Create 2020-12-16 14:35 * @description */ public class ProdConsumer_BlockQueueDemo { public static void main(String[] args) { MyResource resource = new MyResource(new ArrayBlockingQueue<>(10)); new Thread(()->{ System.out.println(Thread.currentThread().getName()+"\t 生产线程启动!"); try { resource.myProd(); } catch (Exception e) { e.printStackTrace(); } },"prod").start(); new Thread(()->{ System.out.println(Thread.currentThread().getName()+"\t 消费线程启动!"); try { try { // 线程睡眠4秒钟 TimeUnit.SECONDS.sleep(4); } catch (InterruptedException e) {e.printStackTrace();} resource.myConsumer(); } catch (Exception e) { e.printStackTrace(); } },"consumer").start(); try { // 线程睡眠10秒钟 TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) {e.printStackTrace();} System.out.println(); System.out.println(); System.out.println(); System.out.println("10秒钟后,停止生产线程"); resource.stop(); } } class MyResource{ /* 默认开启,进行生产+消费 */ private volatile boolean FLAG = true; private AtomicInteger atomicInteger = new AtomicInteger(); BlockingQueue<String> blockingQueue = null; public MyResource(BlockingQueue<String> blockingQueue) { System.out.println(blockingQueue.getClass().getName()); this.blockingQueue = blockingQueue; } public void myProd() throws Exception{ String data = null; boolean retValue; while (FLAG){ data = String.valueOf(atomicInteger.incrementAndGet()); retValue = blockingQueue.offer(data, 2L, TimeUnit.SECONDS); if (retValue){ System.out.println(Thread.currentThread().getName()+"\t 插入队列"+data+"成功!"); }else{ System.out.println(Thread.currentThread().getName()+"\t 插入队列"+data+"失败!"); } try { // 线程睡眠1秒钟 TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) {e.printStackTrace();} } System.out.println(Thread.currentThread().getName()+"\t 线程停止,生产动作结束!"); } public void myConsumer() throws Exception{ String result = null; while (FLAG){ result = blockingQueue.poll(4L,TimeUnit.SECONDS); if (null == result||result.equalsIgnoreCase("")){ FLAG = false; System.out.println(Thread.currentThread().getName()+"\t 超过4秒没有消费,消费退出"); return; } System.out.println(Thread.currentThread().getName()+"\t 消费队列"+result+"成功!"); } } public void stop(){ this.FLAG = false; } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 线程池
- 消息中间间
在多线程领域:所谓阻塞,在某些情况下会挂起线程(即阻塞),一旦条件满足,被挂起的线程又会自动被唤醒。
好处是我们u需要关心什么时候需要阻塞线程,什么时候需要唤醒线程,因为Blocking Queue都包办了。
在concurrent包发布以前,在多线程环境下,我们每个程序员都必须自己控制这些细节,尤其还要兼顾效率和线程安全,而这会给们的程序带来不小的复杂度。
Synchronized是关键字属于JVM层面,编译之后Synchronized会有monitorenter和monitorexit
monitorenter(底层是通过monitor对象来完成,其实wait/notify等方法也依赖于monitor对象只有在同步方法块或方法中才能调wait/notify等方法)
monitorexit
lock是类,api层面的锁。
synchronized反编译之后会生成一个monitorenter和两个monitorexit,monitorenter用于上锁,monitorexit用于去掉锁,有两个是防止报异常之后锁不释放。
Synchronized 不需要用户手动释放锁,当Synchronized 代码执行完后系统会让线程释放对锁的占用
ReentrantLock 需要 用户主动释放锁,如果没有主动释放则可能会导致出现死锁问题。
Synchronized 不可中断,除非抛出异常或者正常运行。
ReentrantLock 可中断。设置超时方法tryLock(long timeout, TimeUnit unit); lockInterruptibly()放入代码块中,调用interr()方法可中断。
Synchronized 非公平锁
ReentrantLock 两种锁都可以,默认非公平锁,构造方法可以传入Boolean值
Synchronized 没有
ReentrantLock 用来实现分组唤醒需要唤醒的县城们,可以精确唤醒,而不像Synchronized 要么随机唤醒要么全部唤醒
精确唤醒指定线程案例:
/** * 题目:多线程之间按顺序调用,实现A->B->C三个线程启动,要求如下 * AA打印五次,BB打印十次,CC打印十五次 * 紧接着 * AA打印五次,BB打印十次,CC打印十五次 * ...... * 来十轮 * * @author shiwenquan * @Create 2020-12-16 15:20 * @description */ public class SyncAndLockDemo { public static void main(String[] args) { ShareResource resource = new ShareResource(); new Thread(()->{ for (int i = 0; i < 10; i++) { resource.print5(); } },"AA").start(); new Thread(()->{ for (int i = 0; i < 10; i++) { resource.print10(); } },"BB").start(); new Thread(()->{ for (int i = 0; i < 10; i++) { resource.print15(); } },"CC").start(); } } class ShareResource{ private int num = 1; private Lock lock = new ReentrantLock(); private Condition condition1 = lock.newCondition(); private Condition condition2 = lock.newCondition(); private Condition condition3 = lock.newCondition(); public void print5(){ lock.lock(); try { while (num != 1){ condition1.await(); } for (int i = 0; i < 5; i++) { System.out.println(Thread.currentThread().getName()+"\t "+i); } num = 2; condition2.signal(); }catch (Exception e){ e.printStackTrace(); }finally { lock.unlock(); } } public void print10(){ lock.lock(); try { while (num != 2){ condition2.await(); } for (int i = 0; i < 10; i++) { System.out.println(Thread.currentThread().getName()+"\t "+i); } num = 3; condition3.signal(); }catch (Exception e){ e.printStackTrace(); }finally { lock.unlock(); } } public void print15(){ lock.lock(); try { while (num != 3){ try { TimeUnit.SECONDS.sleep(4);} catch (InterruptedException e) {e.printStackTrace();} condition3.await(); } for (int i = 0; i < 15; i++) { System.out.println(Thread.currentThread().getName()+"\t "+i); } num = 1; condition1.signal(); }catch (Exception e){ e.printStackTrace(); }finally { lock.unlock(); } lock.lock(); try { }catch (Exception e){ e.printStackTrace(); }finally { lock.unlock(); } } }
线程池做的工作主要是控制运行的线程的数量,处理过程中将任务放入队列,然后在线程创建后启动这些任务,如果线程数量超过了最大数量的线程排队等候,等其他线程执行完毕,再从队列中取出任务执行。
特点:线程复用、控制最大并发数、管理线程。
降低资源消耗,通过重复利用已创建的线程降低线程创建和销毁造成的消耗。
提高响应速度,当任务到达时,任务可以不需要等到线程创建就能立即执行。
提高线程管理性,线程是稀缺资源,如果无限制创建,不仅会消耗系统资源,还会降低系统的稳定性,使用线程池可以进行统一分配调优和监控。
架构说明
Java中线程池是通过Executor框架来实现,该框架中用到了Executor,Executors,ExecutorService,ThreadPoolExecutor这几个类。
编码实现
Executors.newScheduledThreadPool()
Executors.newWorkStealingpool(int) ----->java8新出
Executors.newFixedThreadPool(int) ----->执行长期的任务,性能好很多。
/** * Creates a thread pool that reuses a fixed number of threads * operating off a shared unbounded queue. At any point, at most * {@code nThreads} threads will be active processing tasks. * If additional tasks are submitted when all threads are active, * they will wait in the queue until a thread is available. * If any thread terminates due to a failure during execution * prior to shutdown, a new one will take its place if needed to * execute subsequent tasks. The threads in the pool will exist * until it is explicitly {@link ExecutorService#shutdown shutdown}. * * @param nThreads the number of threads in the pool * @return the newly created thread pool * @throws IllegalArgumentException if {@code nThreads <= 0} */ public static ExecutorService newFixedThreadPool(int nThreads) { return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); }
特点:
- 创建一个固定长度的线程池,可控制线程最大并发数,超出的线程会在队列中等待。
- newFixedThreadPool创建线程池corePoolSize和maximumPoolSize值是相等的,它使用LinkedBlockingQueue。
Executors.newSingleThreadExecutor() ----->一个任务一个任务执行的场景
/** * Creates an Executor that uses a single worker thread operating * off an unbounded queue. (Note however that if this single * thread terminates due to a failure during execution prior to * shutdown, a new one will take its place if needed to execute * subsequent tasks.) Tasks are guaranteed to execute * sequentially, and no more than one task will be active at any * given time. Unlike the otherwise equivalent * {@code newFixedThreadPool(1)} the returned executor is * guaranteed not to be reconfigurable to use additional threads. * * @return the newly created single-threaded Executor */ public static ExecutorService newSingleThreadExecutor() { return new FinalizableDelegatedExecutorService (new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>())); }
> 特点: > > 1. 创建只有一个线程的线程池,它只会用唯一的工作线程来执行任务,保证所有任务按照指定顺序执行。 > 2. newSingleThreadExecutor将corePoolSize和maximumPoolSize值都是 1 ,它使用**LinkedBlockingQueue**。 * Executors.newCachedTheadPool() ----->执行很多短期异步的小程序或者负责较轻的服务器。 ```java /** * Creates a thread pool that creates new threads as needed, but * will reuse previously constructed threads when they are * available. These pools will typically improve the performance * of programs that execute many short-lived asynchronous tasks. * Calls to {@code execute} will reuse previously constructed * threads if available. If no existing thread is available, a new * thread will be created and added to the pool. Threads that have * not been used for sixty seconds are terminated and removed from * the cache. Thus, a pool that remains idle for long enough will * not consume any resources. Note that pools with similar * properties but different details (for example, timeout parameters) * may be created using {@link ThreadPoolExecutor} constructors. * * @return the newly created thread pool */ public static ExecutorService newCachedThreadPool() { return new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); }
特点:
- 创建一个可缓存线程池,如果线程池长度超过处理需要,可灵活回收空闲线程,若无可回收,则新建线程。
- newCachedThreadPool将corePoolSize设置为0,maximumPoolSize设置为Integer.MAX_VALUE,使用的SynchronousQueue,也就是说来了任务就创建线程运行,当线程空闲超过60秒,就销毁线程。
ThreadPoolExecutor
ThreadPoolExecutor七大参数介绍:
corePoolSize
:线程池中常驻核心线程数maximumPoolSize
:线程池能够容纳同时执行的最大线程数,此值必须大于1.keepAliveTime
:多余的空闲线程存活时间。corePoolSize
时,当空闲时间达到keepAliveTime
值时,多余空闲线程会被销毁直到只剩下corePoolSize
个线程为止。unit
:keepAliveTime
的单位。workQueue
:任务队列,被提交但尚未执行的任务。threadFactory
:表示生成线程池中工作线程的线程工厂,用于创建线程一般用默认的即可。handler
:拒绝策略,表示当队列满了并且工作线程大于等于线程池的最大线程数(maximumPoolSize)时如何来execute()
方法添加一个请求任务时,线程池会做如下判断:JDK内置的拒绝策略:(均实现了RejectedExecutionHandler
接口)
AbortPolicy
(默认):直接抛出RejectedExecutionException
异常组织系统正常运行。CallerRunsPolicy
:“调用者运行”一种调节机制,该策略既不会抛弃任务,也不会抛出异常,而是将某些任务回退到调用者,从而降低新任务流量。DiscardOldestPolicy
:抛弃队列中等待最久的任务,然后把当前任务加入队列中尝试再次提交当前任务。DiscardPolicy
:直接丢弃任务,不予处理也不抛异常。如果允许任务丢失,这是最好的一种方案。代码:
/** * 死锁是指两个或者两个以上的进程在执行过程中,因争夺资源而造成的一种相互等待现象 * * @author shiwenquan * @Create 2020-12-24 16:53 * @description */ public class DeadLockDemo { public static void main(String[] args) { String lockA = "lockA"; String lockB = "lockB"; new Thread(new HoldLockThread(lockA,lockB),"AAA").start(); new Thread(new HoldLockThread(lockB,lockA),"BBB").start(); } } class HoldLockThread implements Runnable{ private String lockA; private String lockB; public HoldLockThread(String lockA, String lockB) { this.lockA = lockA; this.lockB = lockB; } @Override public void run() { synchronized (lockA){ System.out.println(Thread.currentThread().getName()+"\t 自己持有" + lockA + "\t 尝试获得" + lockB); try { // 线程睡眠2秒钟 TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) {e.printStackTrace();} synchronized (lockB){ System.out.println(Thread.currentThread().getName()+"\t 自己持有" + lockB + "\t 尝试获得" + lockA); } } } }
解决:
jps命令定位进程号
jps -l
11488 org.jetbrains.idea.maven.server.RemoteMavenServer36
16304 org.jetbrains.jps.cmdline.Launcher
14452 org.study.guigu.DeadLockDemo
12760
13164 org.jetbrains.kotlin.daemon.KotlinCompileDaemon
15596 sun.tools.jps.Jps
jstack查看具体进程号确定是否是死锁。
jstack 14452 2020-12-24 17:04:55 Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.231-b11 mixed mode): "DestroyJavaVM" #13 prio=5 os_prio=0 tid=0x0000000002d32800 nid=0x19f8 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "BBB" #12 prio=5 os_prio=0 tid=0x0000000018e81000 nid=0x4194 waiting for monitor entry [0x0000000019aff000] java.lang.Thread.State: BLOCKED (on object monitor) at org.study.guigu.HoldLockThread.run(DeadLockDemo.java:44) - waiting to lock <0x00000000d5dfd838> (a java.lang.String) - locked <0x00000000d5dfd870> (a java.lang.String) at java.lang.Thread.run(Thread.java:748) "AAA" #11 prio=5 os_prio=0 tid=0x0000000018e7e000 nid=0x3f9c waiting for monitor entry [0x00000000199ff000] java.lang.Thread.State: BLOCKED (on object monitor) at org.study.guigu.HoldLockThread.run(DeadLockDemo.java:44) - waiting to lock <0x00000000d5dfd870> (a java.lang.String) - locked <0x00000000d5dfd838> (a java.lang.String) at java.lang.Thread.run(Thread.java:748) "Service Thread" #10 daemon prio=9 os_prio=0 tid=0x0000000018dea000 nid=0x4354 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C1 CompilerThread2" #9 daemon prio=9 os_prio=2 tid=0x0000000018d48800 nid=0x3644 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread1" #8 daemon prio=9 os_prio=2 tid=0x0000000018d46000 nid=0x3108 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread0" #7 daemon prio=9 os_prio=2 tid=0x0000000018d19000 nid=0x42d8 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Monitor Ctrl-Break" #6 daemon prio=5 os_prio=0 tid=0x0000000018d51800 nid=0x3f74 runnable [0x00000000193fe000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) - locked <0x00000000d5d8ca88> (a java.io.InputStreamReader) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.readLine(BufferedReader.java:324) - locked <0x00000000d5d8ca88> (a java.io.InputStreamReader) at java.io.BufferedReader.readLine(BufferedReader.java:389) at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64) "Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x00000000179af000 nid=0x3e98 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000018d08800 nid=0x4108 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Finalizer" #3 daemon prio=8 os_prio=1 tid=0x0000000002e2b800 nid=0x416c in Object.wait() [0x0000000018cff000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000000d5c08ed8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144) - locked <0x00000000d5c08ed8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216) "Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x000000001798a000 nid=0x244 in Object.wait() [0x0000000018bff000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000000d5c06c00> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:502) at java.lang.ref.Reference.tryHandlePending(Reference.java:191) - locked <0x00000000d5c06c00> (a java.lang.ref.Reference$Lock) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153) "VM Thread" os_prio=2 tid=0x0000000017968000 nid=0x4310 runnable "GC task thread#0 (ParallelGC)" os_prio=0 tid=0x0000000002d48800 nid=0x3654 runnable "GC task thread#1 (ParallelGC)" os_prio=0 tid=0x0000000002d4a000 nid=0x608 runnable "GC task thread#2 (ParallelGC)" os_prio=0 tid=0x0000000002d4b800 nid=0xdec runnable "GC task thread#3 (ParallelGC)" os_prio=0 tid=0x0000000002d4e000 nid=0x2568 runnable "VM Periodic Task Thread" os_prio=2 tid=0x0000000018df0000 nid=0x42d4 waiting on condition JNI global references: 12 Found one Java-level deadlock: ============================= "BBB": waiting to lock monitor 0x0000000002e28768 (object 0x00000000d5dfd838, a java.lang.String), which is held by "AAA" "AAA": waiting to lock monitor 0x0000000002e2aff8 (object 0x00000000d5dfd870, a java.lang.String), which is held by "BBB" Java stack information for the threads listed above: =================================================== "BBB": at org.study.guigu.HoldLockThread.run(DeadLockDemo.java:44) - waiting to lock <0x00000000d5dfd838> (a java.lang.String) - locked <0x00000000d5dfd870> (a java.lang.String) at java.lang.Thread.run(Thread.java:748) "AAA": at org.study.guigu.HoldLockThread.run(DeadLockDemo.java:44) - waiting to lock <0x00000000d5dfd870> (a java.lang.String) - locked <0x00000000d5dfd838> (a java.lang.String) at java.lang.Thread.run(Thread.java:748) Found 1 deadlock.
GC作用在方法区和堆中。
常见垃圾回收算法:
什么是垃圾:内存中已经不再使用的的空间就是垃圾。
可以作为GC Roots的对象:
X参数
XX参数
Boolean类型
-XX:+或者 -某个属性
+表示开启
-表示关闭
Case:
是否打印GC收集细节
E:\workspace\study-guigu>jps -l 1520 org.jetbrains.kotlin.daemon.KotlinCompileDaemon 15144 org.study.guigu.GCRootsDemo 15020 sun.tools.jps.Jps 508 org.jetbrains.jps.cmdline.Launcher 8316 E:\workspace\study-guigu>jinfo -flag PrintGCDetails 15144 -XX:-PrintGCDetails
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
是否使用串行垃圾回收器
E:\workspace\study-guigu>jps -l 1520 org.jetbrains.kotlin.daemon.KotlinCompileDaemon 240 org.jetbrains.jps.cmdline.Launcher 8580 sun.tools.jps.Jps 15048 org.study.guigu.GCRootsDemo 8316 E:\workspace\study-guigu>jinfo -flag UseSerialGC 15048 -XX:-UseSerialGC
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
kv设置类型
-XX:属性key=属性值value
Case:
-XX:MetaspaceSize=128M
E:\workspace\study-guigu>jps -l 1520 org.jetbrains.kotlin.daemon.KotlinCompileDaemon 240 org.jetbrains.jps.cmdline.Launcher 15048 org.study.guigu.GCRootsDemo 1260 sun.tools.jps.Jps 8316 E:\workspace\study-guigu>jinfo -flag MetaspaceSize 15048 -XX:MetaspaceSize=21807104
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-XX:MaxTenuringThreshold=15
E:\workspace\study-guigu>jinfo -flag MaxTenuringThreshold 15048 -XX:MaxTenuringThreshold=15
- 1
- 2
jinfo举例,如何查看当前运行程序的配置
E:\workspace\study-guigu>jinfo -flags 15048
Attaching to process ID 15048, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.231-b11
Non-default VM flags: -XX:CICompilerCount=3 -XX:InitialHeapSize=134217728 -XX:MaxHeapSize=2126512128 -XX:MaxNewSize=708837376 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=44
564480 -XX:OldSize=89653248 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParalle
lGC
Command line: -javaagent:D:\IntellijIDEA\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar=55753:D:\IntellijIDEA\IntelliJ IDEA 2019.2.4\bin -Dfile.encoding=UTF-8
两个经典参数:-Xms和-Xmx
-Xms等价于-XX:InitialHeapSize
-Xmx等价于-XX:MaxHeapSize
命令:java -XX:+PrintFlagsInitial
E:\workspace\study-guigu>java -XX:+PrintFlagsInitial [Global flags] intx ActiveProcessorCount = -1 {product} uintx AdaptiveSizeDecrementScaleFactor = 4 {product} uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product} uintx AdaptiveSizePausePolicy = 0 {product} uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product} uintx AdaptiveSizePolicyInitializingSteps = 20 {product} uintx AdaptiveSizePolicyOutputInterval = 0 {product} uintx AdaptiveSizePolicyWeight = 10 {product} uintx AdaptiveSizeThroughPutPolicy = 0 {product} uintx AdaptiveTimeWeight = 25 {product} bool AdjustConcurrency = false {product} bool AggressiveHeap = false {product} bool AggressiveOpts = false {product} intx AliasLevel = 3 {C2 product} bool AlignVector = true {C2 product} intx AllocateInstancePrefetchLines = 1 {product} intx AllocatePrefetchDistance = -1 {product} intx AllocatePrefetchInstr = 0 {product} intx AllocatePrefetchLines = 3 {product} intx AllocatePrefetchStepSize = 16 {product} intx AllocatePrefetchStyle = 1 {product} bool AllowJNIEnvProxy = false {product} bool AllowNonVirtualCalls = false {product} bool AllowParallelDefineClass = false {product} bool AllowUserSignalHandlers = false {product} bool AlwaysActAsServerClassMachine = false {product} bool AlwaysCompileLoopMethods = false {product} bool AlwaysLockClassLoader = false {product} bool AlwaysPreTouch = false {product} bool AlwaysRestoreFPU = false {product} bool AlwaysTenure = false {product} bool AssertOnSuspendWaitFailure = false {product} bool AssumeMP = false {product} intx AutoBoxCacheMax = 128 {C2 product} uintx AutoGCSelectPauseMillis = 5000 {product} intx BCEATraceLevel = 0 {product} intx BackEdgeThreshold = 100000 {pd product} bool BackgroundCompilation = true {pd product} uintx BaseFootPrintEstimate = 268435456 {product} intx BiasedLockingBulkRebiasThreshold = 20 {product} intx BiasedLockingBulkRevokeThreshold = 40 {product} intx BiasedLockingDecayTime = 25000 {product} intx BiasedLockingStartupDelay = 4000 {product} bool BindGCTaskThreadsToCPUs = false {product} bool BlockLayoutByFrequency = true {C2 product} intx BlockLayoutMinDiamondPercentage = 20 {C2 product} bool BlockLayoutRotateLoops = true {C2 product} bool BranchOnRegister = false {C2 product} bool BytecodeVerificationLocal = false {product} bool BytecodeVerificationRemote = true {product} bool C1OptimizeVirtualCallProfiling = true {C1 product} bool C1ProfileBranches = true {C1 product} bool C1ProfileCalls = true {C1 product} bool C1ProfileCheckcasts = true {C1 product} bool C1ProfileInlinedCalls = true {C1 product} bool C1ProfileVirtualCalls = true {C1 product} bool C1UpdateMethodData = true {C1 product} intx CICompilerCount = 2 {product} bool CICompilerCountPerCPU = false {product} bool CITime = false {product} bool CMSAbortSemantics = false {product} uintx CMSAbortablePrecleanMinWorkPerIteration = 100 {product} intx CMSAbortablePrecleanWaitMillis = 100 {manageable} uintx CMSBitMapYieldQuantum = 10485760 {product} uintx CMSBootstrapOccupancy = 50 {product} bool CMSClassUnloadingEnabled = true {product} uintx CMSClassUnloadingMaxInterval = 0 {product} bool CMSCleanOnEnter = true {product} bool CMSCompactWhenClearAllSoftRefs = true {product} uintx CMSConcMarkMultiple = 32 {product} bool CMSConcurrentMTEnabled = true {product} uintx CMSCoordinatorYieldSleepCount = 10 {product} bool CMSDumpAtPromotionFailure = false {product} bool CMSEdenChunksRecordAlways = true {product} uintx CMSExpAvgFactor = 50 {product} bool CMSExtrapolateSweep = false {product} uintx CMSFullGCsBeforeCompaction = 0 {product} uintx CMSIncrementalDutyCycle = 10 {product} uintx CMSIncrementalDutyCycleMin = 0 {product} bool CMSIncrementalMode = false {product} uintx CMSIncrementalOffset = 0 {product} bool CMSIncrementalPacing = true {product} uintx CMSIncrementalSafetyFactor = 10 {product} uintx CMSIndexedFreeListReplenish = 4 {product} intx CMSInitiatingOccupancyFraction = -1 {product} uintx CMSIsTooFullPercentage = 98 {product} double CMSLargeCoalSurplusPercent = 0.950000 {product} double CMSLargeSplitSurplusPercent = 1.000000 {product} bool CMSLoopWarn = false {product} uintx CMSMaxAbortablePrecleanLoops = 0 {product} intx CMSMaxAbortablePrecleanTime = 5000 {product} uintx CMSOldPLABMax = 1024 {product} uintx CMSOldPLABMin = 16 {product} uintx CMSOldPLABNumRefills = 4 {product} uintx CMSOldPLABReactivityFactor = 2 {product} bool CMSOldPLABResizeQuicker = false {product} uintx CMSOldPLABToleranceFactor = 4 {product} bool CMSPLABRecordAlways = true {product} uintx CMSParPromoteBlocksToClaim = 16 {product} bool CMSParallelInitialMarkEnabled = true {product} bool CMSParallelRemarkEnabled = true {product} bool CMSParallelSurvivorRemarkEnabled = true {product} uintx CMSPrecleanDenominator = 3 {product} uintx CMSPrecleanIter = 3 {product} uintx CMSPrecleanNumerator = 2 {product} bool CMSPrecleanRefLists1 = true {product} bool CMSPrecleanRefLists2 = false {product} bool CMSPrecleanSurvivors1 = false {product} bool CMSPrecleanSurvivors2 = true {product} uintx CMSPrecleanThreshold = 1000 {product} bool CMSPrecleaningEnabled = true {product} bool CMSPrintChunksInDump = false {product} bool CMSPrintEdenSurvivorChunks = false {product} bool CMSPrintObjectsInDump = false {product} uintx CMSRemarkVerifyVariant = 1 {product} bool CMSReplenishIntermediate = true {product} uintx CMSRescanMultiple = 32 {product} uintx CMSSamplingGrain = 16384 {product} bool CMSScavengeBeforeRemark = false {product} uintx CMSScheduleRemarkEdenPenetration = 50 {product} uintx CMSScheduleRemarkEdenSizeThreshold = 2097152 {product} uintx CMSScheduleRemarkSamplingRatio = 5 {product} double CMSSmallCoalSurplusPercent = 1.050000 {product} double CMSSmallSplitSurplusPercent = 1.100000 {product} bool CMSSplitIndexedFreeListBlocks = true {product} intx CMSTriggerInterval = -1 {manageable} uintx CMSTriggerRatio = 80 {product} intx CMSWaitDuration = 2000 {manageable} uintx CMSWorkQueueDrainThreshold = 10 {product} bool CMSYield = true {product} uintx CMSYieldSleepCount = 0 {product} uintx CMSYoungGenPerWorker = 67108864 {pd product} uintx CMS_FLSPadding = 1 {product} uintx CMS_FLSWeight = 75 {product} uintx CMS_SweepPadding = 1 {product} uintx CMS_SweepTimerThresholdMillis = 10 {product} uintx CMS_SweepWeight = 75 {product} bool CheckEndorsedAndExtDirs = false {product} bool CheckJNICalls = false {product} bool ClassUnloading = true {product} bool ClassUnloadingWithConcurrentMark = true {product} intx ClearFPUAtPark = 0 {product} bool ClipInlining = true {product} uintx CodeCacheExpansionSize = 65536 {pd product} uintx CodeCacheMinimumFreeSpace = 512000 {product} bool CollectGen0First = false {product} bool CompactFields = true {product} intx CompilationPolicyChoice = 0 {product} ccstrlist CompileCommand = {product} ccstr CompileCommandFile = {product} ccstrlist CompileOnly = {product} intx CompileThreshold = 10000 {pd product} bool CompilerThreadHintNoPreempt = true {product} intx CompilerThreadPriority = -1 {product} intx CompilerThreadStackSize = 0 {pd product} uintx CompressedClassSpaceSize = 1073741824 {product} uintx ConcGCThreads = 0 {product} intx ConditionalMoveLimit = 3 {C2 pd product} intx ContendedPaddingWidth = 128 {product} bool ConvertSleepToYield = true {pd product} bool ConvertYieldToSleep = false {product} bool CrashOnOutOfMemoryError = false {product} bool CreateMinidumpOnCrash = false {product} bool CriticalJNINatives = true {product} bool DTraceAllocProbes = false {product} bool DTraceMethodProbes = false {product} bool DTraceMonitorProbes = false {product} bool Debugging = false {product} uintx DefaultMaxRAMFraction = 4 {product} intx DefaultThreadPriority = -1 {product} intx DeferPollingPageLoopCount = -1 {product} intx DeferThrSuspendLoopCount = 4000 {product} bool DeoptimizeRandom = false {product} bool DisableAttachMechanism = false {product} bool DisableExplicitGC = false {product} bool DisplayVMOutputToStderr = false {product} bool DisplayVMOutputToStdout = false {product} bool DoEscapeAnalysis = true {C2 product} bool DontCompileHugeMethods = true {product} bool DontYieldALot = false {pd product} ccstr DumpLoadedClassList = {product} bool DumpReplayDataOnError = true {product} bool DumpSharedSpaces = false {product} bool EagerXrunInit = false {product} intx EliminateAllocationArraySizeLimit = 64 {C2 product} bool EliminateAllocations = true {C2 product} bool EliminateAutoBox = true {C2 product} bool EliminateLocks = true {C2 product} bool EliminateNestedLocks = true {C2 product} intx EmitSync = 0 {product} bool EnableContended = true {product} bool EnableResourceManagementTLABCache = true {product} bool EnableSharedLookupCache = true {product} bool EnableTracing = false {product} uintx ErgoHeapSizeLimit = 0 {product} ccstr ErrorFile = {product} ccstr ErrorReportServer = {product} double EscapeAnalysisTimeout = 20.000000 {C2 product} bool EstimateArgEscape = true {product} bool ExitOnOutOfMemoryError = false {product} bool ExplicitGCInvokesConcurrent = false {product} bool ExplicitGCInvokesConcurrentAndUnloadsClasses = false {product} bool ExtendedDTraceProbes = false {product} ccstr ExtraSharedClassListFile = {product} bool FLSAlwaysCoalesceLarge = false {product} uintx FLSCoalescePolicy = 2 {product} double FLSLargestBlockCoalesceProximity = 0.990000 {product} bool FailOverToOldVerifier = true {product} bool FastTLABRefill = true {product} intx FenceInstruction = 0 {ARCH product} intx FieldsAllocationStyle = 1 {product} bool FilterSpuriousWakeups = true {product} ccstr FlightRecorderOptions = {product} bool ForceNUMA = false {product} bool ForceTimeHighResolution = false {product} intx FreqInlineSize = 325 {pd product} double G1ConcMarkStepDurationMillis = 10.000000 {product} uintx G1ConcRSHotCardLimit = 4 {product} uintx G1ConcRSLogCacheSize = 10 {product} intx G1ConcRefinementGreenZone = 0 {product} intx G1ConcRefinementRedZone = 0 {product} intx G1ConcRefinementServiceIntervalMillis = 300 {product} uintx G1ConcRefinementThreads = 0 {product} intx G1ConcRefinementThresholdStep = 0 {product} intx G1ConcRefinementYellowZone = 0 {product} uintx G1ConfidencePercent = 50 {product} uintx G1HeapRegionSize = 0 {product} uintx G1HeapWastePercent = 5 {product} uintx G1MixedGCCountTarget = 8 {product} intx G1RSetRegionEntries = 0 {product} uintx G1RSetScanBlockSize = 64 {product} intx G1RSetSparseRegionEntries = 0 {product} intx G1RSetUpdatingPauseTimePercent = 10 {product} intx G1RefProcDrainInterval = 10 {product} uintx G1ReservePercent = 10 {product} uintx G1SATBBufferEnqueueingThresholdPercent = 60 {product} intx G1SATBBufferSize = 1024 {product} intx G1UpdateBufferSize = 256 {product} bool G1UseAdaptiveConcRefinement = true {product} uintx GCDrainStackTargetSize = 64 {product} uintx GCHeapFreeLimit = 2 {product} uintx GCLockerEdenExpansionPercent = 5 {product} bool GCLockerInvokesConcurrent = false {product} uintx GCLogFileSize = 8192 {product} uintx GCPauseIntervalMillis = 0 {product} uintx GCTaskTimeStampEntries = 200 {product} uintx GCTimeLimit = 98 {product} uintx GCTimeRatio = 99 {product} uintx HeapBaseMinAddress = 2147483648 {pd product} bool HeapDumpAfterFullGC = false {manageable} bool HeapDumpBeforeFullGC = false {manageable} bool HeapDumpOnOutOfMemoryError = false {manageable} ccstr HeapDumpPath = {manageable} uintx HeapFirstMaximumCompactionCount = 3 {product} uintx HeapMaximumCompactionInterval = 20 {product} uintx HeapSizePerGCThread = 87241520 {product} bool IgnoreEmptyClassPaths = false {product} bool IgnoreUnrecognizedVMOptions = false {product} uintx IncreaseFirstTierCompileThresholdAt = 50 {product} bool IncrementalInline = true {C2 product} uintx InitialBootClassLoaderMetaspaceSize = 4194304 {product} uintx InitialCodeCacheSize = 2555904 {pd product} uintx InitialHeapSize = 0 {product} uintx InitialRAMFraction = 64 {product} double InitialRAMPercentage = 1.562500 {product} uintx InitialSurvivorRatio = 8 {product} uintx InitialTenuringThreshold = 7 {product} uintx InitiatingHeapOccupancyPercent = 45 {product} bool Inline = true {product} ccstr InlineDataFile = {product} intx InlineSmallCode = 1000 {pd product} bool InlineSynchronizedMethods = true {C1 product} bool InsertMemBarAfterArraycopy = true {C2 product} intx InteriorEntryAlignment = 16 {C2 pd product} intx InterpreterProfilePercentage = 33 {product} bool JNIDetachReleasesMonitors = true {product} bool JavaMonitorsInStackTrace = true {product} intx JavaPriority10_To_OSPriority = -1 {product} intx JavaPriority1_To_OSPriority = -1 {product} intx JavaPriority2_To_OSPriority = -1 {product} intx JavaPriority3_To_OSPriority = -1 {product} intx JavaPriority4_To_OSPriority = -1 {product} intx JavaPriority5_To_OSPriority = -1 {product} intx JavaPriority6_To_OSPriority = -1 {product} intx JavaPriority7_To_OSPriority = -1 {product} intx JavaPriority8_To_OSPriority = -1 {product} intx JavaPriority9_To_OSPriority = -1 {product} bool LIRFillDelaySlots = false {C1 pd product} uintx LargePageHeapSizeThreshold = 134217728 {product} uintx LargePageSizeInBytes = 0 {product} bool LazyBootClassLoader = true {product} intx LiveNodeCountInliningCutoff = 40000 {C2 product} bool LogCommercialFeatures = false {product} intx LoopMaxUnroll = 16 {C2 product} intx LoopOptsCount = 43 {C2 product} intx LoopUnrollLimit = 60 {C2 pd product} intx LoopUnrollMin = 4 {C2 product} bool LoopUnswitching = true {C2 product} bool ManagementServer = false {product} uintx MarkStackSize = 4194304 {product} uintx MarkStackSizeMax = 536870912 {product} uintx MarkSweepAlwaysCompactCount = 4 {product} uintx MarkSweepDeadRatio = 5 {product} intx MaxBCEAEstimateLevel = 5 {product} intx MaxBCEAEstimateSize = 150 {product} uintx MaxDirectMemorySize = 0 {product} bool MaxFDLimit = true {product} uintx MaxGCMinorPauseMillis = 4294967295 {product} uintx MaxGCPauseMillis = 4294967295 {product} uintx MaxHeapFreeRatio = 70 {manageable} uintx MaxHeapSize = 130862280 {product} intx MaxInlineLevel = 9 {product} intx MaxInlineSize = 35 {product} intx MaxJNILocalCapacity = 65536 {product} intx MaxJavaStackTraceDepth = 1024 {product} intx MaxJumpTableSize = 65000 {C2 product} intx MaxJumpTableSparseness = 5 {C2 product} intx MaxLabelRootDepth = 1100 {C2 product} intx MaxLoopPad = 15 {C2 product} uintx MaxMetaspaceExpansion = 5452592 {product} uintx MaxMetaspaceFreeRatio = 70 {product} uintx MaxMetaspaceSize = 4294967295 {product} uintx MaxNewSize = 4294967295 {product} intx MaxNodeLimit = 80000 {C2 product} uint64_t MaxRAM = 0 {pd product} uintx MaxRAMFraction = 4 {product} double MaxRAMPercentage = 25.000000 {product} intx MaxRecursiveInlineLevel = 1 {product} uintx MaxTenuringThreshold = 15 {product} intx MaxTrivialSize = 6 {product} intx MaxVectorSize = 32 {C2 product} uintx MetaspaceSize = 21810376 {pd product} bool MethodFlushing = true {product} uintx MinHeapDeltaBytes = 170392 {product} uintx MinHeapFreeRatio = 40 {manageable} intx MinInliningThreshold = 250 {product} intx MinJumpTableSize = 10 {C2 pd product} uintx MinMetaspaceExpansion = 340784 {product} uintx MinMetaspaceFreeRatio = 40 {product} uintx MinRAMFraction = 2 {product} double MinRAMPercentage = 50.000000 {product} uintx MinSurvivorRatio = 3 {product} uintx MinTLABSize = 2048 {product} intx MonitorBound = 0 {product} bool MonitorInUseLists = false {product} intx MultiArrayExpandLimit = 6 {C2 product} bool MustCallLoadClassInternal = false {product} uintx NUMAChunkResizeWeight = 20 {product} uintx NUMAInterleaveGranularity = 2097152 {product} uintx NUMAPageScanRate = 256 {product} uintx NUMASpaceResizeRate = 1073741824 {product} bool NUMAStats = false {product} ccstr NativeMemoryTracking = off {product} bool NeedsDeoptSuspend = false {pd product} bool NeverActAsServerClassMachine = false {pd product} bool NeverTenure = false {product} uintx NewRatio = 2 {product} uintx NewSize = 1363144 {product} uintx NewSizeThreadIncrease = 5320 {pd product} intx NmethodSweepActivity = 10 {product} intx NmethodSweepCheckInterval = 5 {product} intx NmethodSweepFraction = 16 {product} intx NodeLimitFudgeFactor = 2000 {C2 product} uintx NumberOfGCLogFiles = 0 {product} intx NumberOfLoopInstrToAlign = 4 {C2 product} intx ObjectAlignmentInBytes = 8 {lp64_product} uintx OldPLABSize = 1024 {product} uintx OldPLABWeight = 50 {product} uintx OldSize = 5452592 {product} bool OmitStackTraceInFastThrow = true {product} ccstrlist OnError = {product} ccstrlist OnOutOfMemoryError = {product} intx OnStackReplacePercentage = 140 {pd product} bool OptimizeFill = true {C2 product} bool OptimizePtrCompare = true {C2 product} bool OptimizeStringConcat = true {C2 product} bool OptoBundling = false {C2 pd product} intx OptoLoopAlignment = 16 {pd product} bool OptoScheduling = false {C2 pd product} uintx PLABWeight = 75 {product} bool PSChunkLargeArrays = true {product} intx ParGCArrayScanChunk = 50 {product} uintx ParGCDesiredObjsFromOverflowList = 20 {product} bool ParGCTrimOverflow = true {product} bool ParGCUseLocalOverflow = false {product} uintx ParallelGCBufferWastePct = 10 {product} uintx ParallelGCThreads = 0 {product} bool ParallelGCVerbose = false {product} uintx ParallelOldDeadWoodLimiterMean = 50 {product} uintx ParallelOldDeadWoodLimiterStdDev = 80 {product} bool ParallelRefProcBalancingEnabled = true {product} bool ParallelRefProcEnabled = false {product} bool PartialPeelAtUnsignedTests = true {C2 product} bool PartialPeelLoop = true {C2 product} intx PartialPeelNewPhiDelta = 0 {C2 product} uintx PausePadding = 1 {product} intx PerBytecodeRecompilationCutoff = 200 {product} intx PerBytecodeTrapLimit = 4 {product} intx PerMethodRecompilationCutoff = 400 {product} intx PerMethodTrapLimit = 100 {product} bool PerfAllowAtExitRegistration = false {product} bool PerfBypassFileSystemCheck = false {product} intx PerfDataMemorySize = 32768 {product} intx PerfDataSamplingInterval = 50 {product} ccstr PerfDataSaveFile = {product} bool PerfDataSaveToFile = false {product} bool PerfDisableSharedMem = false {product} intx PerfMaxStringConstLength = 1024 {product} intx PreInflateSpin = 10 {pd product} bool PreferInterpreterNativeStubs = false {pd product} intx PrefetchCopyIntervalInBytes = -1 {product} intx PrefetchFieldsAhead = -1 {product} intx PrefetchScanIntervalInBytes = -1 {product} bool PreserveAllAnnotations = false {product} bool PreserveFramePointer = false {pd product} uintx PretenureSizeThreshold = 0 {product} bool PrintAdaptiveSizePolicy = false {product} bool PrintCMSInitiationStatistics = false {product} intx PrintCMSStatistics = 0 {product} bool PrintClassHistogram = false {manageable} bool PrintClassHistogramAfterFullGC = false {manageable} bool PrintClassHistogramBeforeFullGC = false {manageable} bool PrintCodeCache = false {product} bool PrintCodeCacheOnCompilation = false {product} bool PrintCommandLineFlags = false {product} bool PrintCompilation = false {product} bool PrintConcurrentLocks = false {manageable} intx PrintFLSCensus = 0 {product} intx PrintFLSStatistics = 0 {product} bool PrintFlagsFinal = false {product} bool PrintFlagsInitial = false {product} bool PrintGC = false {manageable} bool PrintGCApplicationConcurrentTime = false {product} bool PrintGCApplicationStoppedTime = false {product} bool PrintGCCause = true {product} bool PrintGCDateStamps = false {manageable} bool PrintGCDetails = false {manageable} bool PrintGCID = false {manageable} bool PrintGCTaskTimeStamps = false {product} bool PrintGCTimeStamps = false {manageable} bool PrintHeapAtGC = false {product rw} bool PrintHeapAtGCExtended = false {product rw} bool PrintHeapAtSIGBREAK = true {product} bool PrintJNIGCStalls = false {product} bool PrintJNIResolving = false {product} bool PrintOldPLAB = false {product} bool PrintOopAddress = false {product} bool PrintPLAB = false {product} bool PrintParallelOldGCPhaseTimes = false {product} bool PrintPromotionFailure = false {product} bool PrintReferenceGC = false {product} bool PrintSafepointStatistics = false {product} intx PrintSafepointStatisticsCount = 300 {product} intx PrintSafepointStatisticsTimeout = -1 {product} bool PrintSharedArchiveAndExit = false {product} bool PrintSharedDictionary = false {product} bool PrintSharedSpaces = false {product} bool PrintStringDeduplicationStatistics = false {product} bool PrintStringTableStatistics = false {product} bool PrintTLAB = false {product} bool PrintTenuringDistribution = false {product} bool PrintTieredEvents = false {product} bool PrintVMOptions = false {product} bool PrintVMQWaitTime = false {product} bool PrintWarnings = true {product} uintx ProcessDistributionStride = 4 {product} bool ProfileInterpreter = true {pd product} bool ProfileIntervals = false {product} intx ProfileIntervalsTicks = 100 {product} intx ProfileMaturityPercentage = 20 {product} bool ProfileVM = false {product} bool ProfilerPrintByteCodeStatistics = false {product} bool ProfilerRecordPC = false {product} uintx PromotedPadding = 3 {product} uintx QueuedAllocationWarningCount = 0 {product} uintx RTMRetryCount = 5 {ARCH product} bool RangeCheckElimination = true {product} intx ReadPrefetchInstr = 0 {ARCH product} bool ReassociateInvariants = true {C2 product} bool ReduceBulkZeroing = true {C2 product} bool ReduceFieldZeroing = true {C2 product} bool ReduceInitialCardMarks = true {C2 product} bool ReduceSignalUsage = false {product} intx RefDiscoveryPolicy = 0 {product} bool ReflectionWrapResolutionErrors = true {product} bool RegisterFinalizersAtInit = true {product} bool RelaxAccessControlCheck = false {product} ccstr ReplayDataFile = {product} bool RequireSharedSpaces = false {product} uintx ReservedCodeCacheSize = 50331648 {pd product} bool ResizeOldPLAB = true {product} bool ResizePLAB = true {product} bool ResizeTLAB = true {pd product} bool RestoreMXCSROnJNICalls = false {product} bool RestrictContended = true {product} bool RewriteBytecodes = true {pd product} bool RewriteFrequentPairs = true {pd product} intx SafepointPollOffset = 256 {C1 pd product} intx SafepointSpinBeforeYield = 2000 {product} bool SafepointTimeout = false {product} intx SafepointTimeoutDelay = 10000 {product} bool ScavengeBeforeFullGC = true {product} intx SelfDestructTimer = 0 {product} uintx SharedBaseAddress = 0 {product} ccstr SharedClassListFile = {product} uintx SharedMiscCodeSize = 122880 {product} uintx SharedMiscDataSize = 4194304 {product} uintx SharedReadOnlySize = 16777216 {product} uintx SharedReadWriteSize = 16777216 {product} bool ShowMessageBoxOnError = false {product} intx SoftRefLRUPolicyMSPerMB = 1000 {product} bool SpecialEncodeISOArray = true {C2 product} bool SplitIfBlocks = true {C2 product} intx StackRedPages = 1 {pd product} intx StackShadowPages = 6 {pd product} bool StackTraceInThrowable = true {product} intx StackYellowPages = 3 {pd product} bool StartAttachListener = false {product} intx StarvationMonitorInterval = 200 {product} bool StressLdcRewrite = false {product} uintx StringDeduplicationAgeThreshold = 3 {product} uintx StringTableSize = 60013 {product} bool SuppressFatalErrorMessage = false {product} uintx SurvivorPadding = 3 {product} uintx SurvivorRatio = 8 {product} intx SuspendRetryCount = 50 {product} intx SuspendRetryDelay = 5 {product} intx SyncFlags = 0 {product} ccstr SyncKnobs = {product} intx SyncVerbose = 0 {product} uintx TLABAllocationWeight = 35 {product} uintx TLABRefillWasteFraction = 64 {product} uintx TLABSize = 0 {product} bool TLABStats = true {product} uintx TLABWasteIncrement = 4 {product} uintx TLABWasteTargetPercent = 1 {product} uintx TargetPLABWastePct = 10 {product} uintx TargetSurvivorRatio = 50 {product} uintx TenuredGenerationSizeIncrement = 20 {product} uintx TenuredGenerationSizeSupplement = 80 {product} uintx TenuredGenerationSizeSupplementDecay = 2 {product} intx ThreadPriorityPolicy = 0 {product} bool ThreadPriorityVerbose = false {product} uintx ThreadSafetyMargin = 52428800 {product} intx ThreadStackSize = 0 {pd product} uintx ThresholdTolerance = 10 {product} intx Tier0BackedgeNotifyFreqLog = 10 {product} intx Tier0InvokeNotifyFreqLog = 7 {product} intx Tier0ProfilingStartPercentage = 200 {product} intx Tier23InlineeNotifyFreqLog = 20 {product} intx Tier2BackEdgeThreshold = 0 {product} intx Tier2BackedgeNotifyFreqLog = 14 {product} intx Tier2CompileThreshold = 0 {product} intx Tier2InvokeNotifyFreqLog = 11 {product} intx Tier3BackEdgeThreshold = 60000 {product} intx Tier3BackedgeNotifyFreqLog = 13 {product} intx Tier3CompileThreshold = 2000 {product} intx Tier3DelayOff = 2 {product} intx Tier3DelayOn = 5 {product} intx Tier3InvocationThreshold = 200 {product} intx Tier3InvokeNotifyFreqLog = 10 {product} intx Tier3LoadFeedback = 5 {product} intx Tier3MinInvocationThreshold = 100 {product} intx Tier4BackEdgeThreshold = 40000 {product} intx Tier4CompileThreshold = 15000 {product} intx Tier4InvocationThreshold = 5000 {product} intx Tier4LoadFeedback = 3 {product} intx Tier4MinInvocationThreshold = 600 {product} bool TieredCompilation = true {pd product} intx TieredCompileTaskTimeout = 50 {product} intx TieredRateUpdateMaxTime = 25 {product} intx TieredRateUpdateMinTime = 1 {product} intx TieredStopAtLevel = 4 {product} bool TimeLinearScan = false {C1 product} bool TraceBiasedLocking = false {product} bool TraceClassLoading = false {product rw} bool TraceClassLoadingPreorder = false {product} bool TraceClassPaths = false {product} bool TraceClassResolution = false {product} bool TraceClassUnloading = false {product rw} bool TraceDynamicGCThreads = false {product} bool TraceGen0Time = false {product} bool TraceGen1Time = false {product} ccstr TraceJVMTI = {product} bool TraceLoaderConstraints = false {product rw} bool TraceMetadataHumongousAllocation = false {product} bool TraceMonitorInflation = false {product} bool TraceParallelOldGCTasks = false {product} intx TraceRedefineClasses = 0 {product} bool TraceSafepointCleanupTime = false {product} bool TraceSharedLookupCache = false {product} bool TraceSuspendWaitFailures = false {product} intx TrackedInitializationLimit = 50 {C2 product} bool TransmitErrorReport = false {product} bool TrapBasedNullChecks = false {pd product} bool TrapBasedRangeChecks = false {C2 pd product} intx TypeProfileArgsLimit = 2 {product} uintx TypeProfileLevel = 111 {pd product} intx TypeProfileMajorReceiverPercent = 90 {C2 product} intx TypeProfileParmsLimit = 2 {product} intx TypeProfileWidth = 2 {product} intx UnguardOnExecutionViolation = 0 {product} bool UnlinkSymbolsALot = false {product} bool Use486InstrsOnly = false {ARCH product} bool UseAES = false {product} bool UseAESIntrinsics = false {product} intx UseAVX = 99 {ARCH product} bool UseAdaptiveGCBoundary = false {product} bool UseAdaptiveGenerationSizePolicyAtMajorCollection = true {product} bool UseAdaptiveGenerationSizePolicyAtMinorCollection = true {product} bool UseAdaptiveNUMAChunkSizing = true {product} bool UseAdaptiveSizeDecayMajorGCCost = true {product} bool UseAdaptiveSizePolicy = true {product} bool UseAdaptiveSizePolicyFootprintGoal = true {product} bool UseAdaptiveSizePolicyWithSystemGC = false {product} bool UseAddressNop = false {ARCH product} bool UseAltSigs = false {product} bool UseAutoGCSelectPolicy = false {product} bool UseBMI1Instructions = false {ARCH product} bool UseBMI2Instructions = false {ARCH product} bool UseBiasedLocking = true {product} bool UseBimorphicInlining = true {C2 product} bool UseBoundThreads = true {product} bool UseCLMUL = false {ARCH product} bool UseCMSBestFit = true {product} bool UseCMSCollectionPassing = true {product} bool UseCMSCompactAtFullCollection = true {product} bool UseCMSInitiatingOccupancyOnly = false {product} bool UseCRC32Intrinsics = false {product} bool UseCodeCacheFlushing = true {product} bool UseCompiler = true {product} bool UseCompilerSafepoints = true {product} bool UseCompressedClassPointers = false {lp64_product} bool UseCompressedOops = false {lp64_product} bool UseConcMarkSweepGC = false {product} bool UseCondCardMark = false {C2 product} bool UseCountLeadingZerosInstruction = false {ARCH product} bool UseCountTrailingZerosInstruction = false {ARCH product} bool UseCountedLoopSafepoints = false {C2 product} bool UseCounterDecay = true {product} bool UseDivMod = true {C2 product} bool UseDynamicNumberOfGCThreads = false {product} bool UseFPUForSpilling = false {C2 product} bool UseFastAccessorMethods = true {product} bool UseFastEmptyMethods = true {product} bool UseFastJNIAccessors = true {product} bool UseFastStosb = false {ARCH product} bool UseG1GC = false {product} bool UseGCLogFileRotation = false {product} bool UseGCOverheadLimit = true {product} bool UseGCTaskAffinity = false {product} bool UseGHASHIntrinsics = false {product} bool UseHeavyMonitors = false {product} bool UseInlineCaches = true {product} bool UseInterpreter = true {product} bool UseJumpTables = true {C2 product} bool UseLWPSynchronization = true {product} bool UseLargePages = false {pd product} bool UseLargePagesInMetaspace = false {product} bool UseLargePagesIndividualAllocation := false {pd product} bool UseLockedTracing = false {product} bool UseLoopCounter = true {product} bool UseLoopInvariantCodeMotion = true {C1 product} bool UseLoopPredicate = true {C2 product} bool UseMathExactIntrinsics = true {C2 product} bool UseMaximumCompactionOnSystemGC = true {product} bool UseMembar = false {pd product} bool UseMontgomeryMultiplyIntrinsic = false {C2 product} bool UseMontgomerySquareIntrinsic = false {C2 product} bool UseMulAddIntrinsic = false {C2 product} bool UseMultiplyToLenIntrinsic = false {C2 product} bool UseNUMA = false {product} bool UseNUMAInterleaving = false {product} bool UseNewLongLShift = false {ARCH product} bool UseOSErrorReporting = false {pd product} bool UseOldInlining = true {C2 product} bool UseOnStackReplacement = true {pd product} bool UseOnlyInlinedBimorphic = true {C2 product} bool UseOptoBiasInlining = true {C2 product} bool UsePSAdaptiveSurvivorSizePolicy = true {product} bool UseParNewGC = false {product} bool UseParallelGC = false {product} bool UseParallelOldGC = false {product} bool UsePerfData = true {product} bool UsePopCountInstruction = false {product} bool UseRDPCForConstantTableBase = false {C2 product} bool UseRTMDeopt = false {ARCH product} bool UseRTMLocking = false {ARCH product} bool UseSHA = false {product} bool UseSHA1Intrinsics = false {product} bool UseSHA256Intrinsics = false {product} bool UseSHA512Intrinsics = false {product} intx UseSSE = 99 {product} bool UseSSE42Intrinsics = false {product} bool UseSerialGC = false {product} bool UseSharedSpaces = true {product} bool UseSignalChaining = true {product} bool UseSquareToLenIntrinsic = false {C2 product} bool UseStoreImmI16 = true {ARCH product} bool UseStringDeduplication = false {product} bool UseSuperWord = true {C2 product} bool UseTLAB = true {pd product} bool UseThreadPriorities = true {pd product} bool UseTypeProfile = true {product} bool UseTypeSpeculation = true {C2 product} bool UseUTCFileTimestamp = true {product} bool UseUnalignedLoadStores = false {ARCH product} bool UseVMInterruptibleIO = false {product} bool UseXMMForArrayCopy = false {product} bool UseXmmI2D = false {ARCH product} bool UseXmmI2F = false {ARCH product} bool UseXmmLoadAndClearUpper = true {ARCH product} bool UseXmmRegToRegMoveAll = false {ARCH product} bool VMThreadHintNoPreempt = false {product} intx VMThreadPriority = -1 {product} intx VMThreadStackSize = 0 {pd product} intx ValueMapInitialSize = 11 {C1 product} intx ValueMapMaxLoopSize = 8 {C1 product} intx ValueSearchLimit = 1000 {C2 product} bool VerifyMergedCPBytecodes = true {product} bool VerifySharedSpaces = false {product} intx WorkAroundNPTLTimedWaitHang = 1 {product} uintx YoungGenerationSizeIncrement = 20 {product} uintx YoungGenerationSizeSupplement = 80 {product} uintx YoungGenerationSizeSupplementDecay = 8 {product} uintx YoungPLABSize = 4096 {product} bool ZeroTLAB = false {product} intx hashCode = 5 {product}
命令:java -XX:+PrintFlagsFinal
E:\workspace\study-guigu> java -XX:+PrintFlagsFinal -version [Global flags] intx ActiveProcessorCount = -1 {product} uintx AdaptiveSizeDecrementScaleFactor = 4 {product} uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product} uintx AdaptiveSizePausePolicy = 0 {product} uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product} uintx AdaptiveSizePolicyInitializingSteps = 20 {product} uintx AdaptiveSizePolicyOutputInterval = 0 {product} uintx AdaptiveSizePolicyWeight = 10 {product} uintx AdaptiveSizeThroughPutPolicy = 0 {product} uintx AdaptiveTimeWeight = 25 {product} bool AdjustConcurrency = false {product} bool AggressiveHeap = false {product} bool AggressiveOpts = false {product} intx AliasLevel = 3 {C2 product} bool AlignVector = false {C2 product} intx AllocateInstancePrefetchLines = 1 {product} intx AllocatePrefetchDistance = 192 {product} intx AllocatePrefetchInstr = 3 {product} intx AllocatePrefetchLines = 4 {product} intx AllocatePrefetchStepSize = 64 {product} intx AllocatePrefetchStyle = 1 {product} bool AllowJNIEnvProxy = false {product} bool AllowNonVirtualCalls = false {product} bool AllowParallelDefineClass = false {product} bool AllowUserSignalHandlers = false {product} bool AlwaysActAsServerClassMachine = false {product} bool AlwaysCompileLoopMethods = false {product} bool AlwaysLockClassLoader = false {product} bool AlwaysPreTouch = false {product} bool AlwaysRestoreFPU = false {product} bool AlwaysTenure = false {product} bool AssertOnSuspendWaitFailure = false {product} bool AssumeMP = false {product} intx AutoBoxCacheMax = 128 {C2 product} uintx AutoGCSelectPauseMillis = 5000 {product} intx BCEATraceLevel = 0 {product} intx BackEdgeThreshold = 100000 {pd product} bool BackgroundCompilation = true {pd product} uintx BaseFootPrintEstimate = 268435456 {product} intx BiasedLockingBulkRebiasThreshold = 20 {product} intx BiasedLockingBulkRevokeThreshold = 40 {product} intx BiasedLockingDecayTime = 25000 {product} intx BiasedLockingStartupDelay = 4000 {product} bool BindGCTaskThreadsToCPUs = false {product} bool BlockLayoutByFrequency = true {C2 product} intx BlockLayoutMinDiamondPercentage = 20 {C2 product} bool BlockLayoutRotateLoops = true {C2 product} bool BranchOnRegister = false {C2 product} bool BytecodeVerificationLocal = false {product} bool BytecodeVerificationRemote = true {product} bool C1OptimizeVirtualCallProfiling = true {C1 product} bool C1ProfileBranches = true {C1 product} bool C1ProfileCalls = true {C1 product} bool C1ProfileCheckcasts = true {C1 product} bool C1ProfileInlinedCalls = true {C1 product} bool C1ProfileVirtualCalls = true {C1 product} bool C1UpdateMethodData = true {C1 product} intx CICompilerCount := 3 {product} bool CICompilerCountPerCPU = true {product} bool CITime = false {product} bool CMSAbortSemantics = false {product} uintx CMSAbortablePrecleanMinWorkPerIteration = 100 {product} intx CMSAbortablePrecleanWaitMillis = 100 {manageable} uintx CMSBitMapYieldQuantum = 10485760 {product} uintx CMSBootstrapOccupancy = 50 {product} bool CMSClassUnloadingEnabled = true {product} uintx CMSClassUnloadingMaxInterval = 0 {product} bool CMSCleanOnEnter = true {product} bool CMSCompactWhenClearAllSoftRefs = true {product} uintx CMSConcMarkMultiple = 32 {product} bool CMSConcurrentMTEnabled = true {product} uintx CMSCoordinatorYieldSleepCount = 10 {product} bool CMSDumpAtPromotionFailure = false {product} bool CMSEdenChunksRecordAlways = true {product} uintx CMSExpAvgFactor = 50 {product} bool CMSExtrapolateSweep = false {product} uintx CMSFullGCsBeforeCompaction = 0 {product} uintx CMSIncrementalDutyCycle = 10 {product} uintx CMSIncrementalDutyCycleMin = 0 {product} bool CMSIncrementalMode = false {product} uintx CMSIncrementalOffset = 0 {product} bool CMSIncrementalPacing = true {product} uintx CMSIncrementalSafetyFactor = 10 {product} uintx CMSIndexedFreeListReplenish = 4 {product} intx CMSInitiatingOccupancyFraction = -1 {product} uintx CMSIsTooFullPercentage = 98 {product} double CMSLargeCoalSurplusPercent = 0.950000 {product} double CMSLargeSplitSurplusPercent = 1.000000 {product} bool CMSLoopWarn = false {product} uintx CMSMaxAbortablePrecleanLoops = 0 {product} intx CMSMaxAbortablePrecleanTime = 5000 {product} uintx CMSOldPLABMax = 1024 {product} uintx CMSOldPLABMin = 16 {product} uintx CMSOldPLABNumRefills = 4 {product} uintx CMSOldPLABReactivityFactor = 2 {product} bool CMSOldPLABResizeQuicker = false {product} uintx CMSOldPLABToleranceFactor = 4 {product} bool CMSPLABRecordAlways = true {product} uintx CMSParPromoteBlocksToClaim = 16 {product} bool CMSParallelInitialMarkEnabled = true {product} bool CMSParallelRemarkEnabled = true {product} bool CMSParallelSurvivorRemarkEnabled = true {product} uintx CMSPrecleanDenominator = 3 {product} uintx CMSPrecleanIter = 3 {product} uintx CMSPrecleanNumerator = 2 {product} bool CMSPrecleanRefLists1 = true {product} bool CMSPrecleanRefLists2 = false {product} bool CMSPrecleanSurvivors1 = false {product} bool CMSPrecleanSurvivors2 = true {product} uintx CMSPrecleanThreshold = 1000 {product} bool CMSPrecleaningEnabled = true {product} bool CMSPrintChunksInDump = false {product} bool CMSPrintEdenSurvivorChunks = false {product} bool CMSPrintObjectsInDump = false {product} uintx CMSRemarkVerifyVariant = 1 {product} bool CMSReplenishIntermediate = true {product} uintx CMSRescanMultiple = 32 {product} uintx CMSSamplingGrain = 16384 {product} bool CMSScavengeBeforeRemark = false {product} uintx CMSScheduleRemarkEdenPenetration = 50 {product} uintx CMSScheduleRemarkEdenSizeThreshold = 2097152 {product} uintx CMSScheduleRemarkSamplingRatio = 5 {product} double CMSSmallCoalSurplusPercent = 1.050000 {product} double CMSSmallSplitSurplusPercent = 1.100000 {product} bool CMSSplitIndexedFreeListBlocks = true {product} intx CMSTriggerInterval = -1 {manageable} uintx CMSTriggerRatio = 80 {product} intx CMSWaitDuration = 2000 {manageable} uintx CMSWorkQueueDrainThreshold = 10 {product} bool CMSYield = true {product} uintx CMSYieldSleepCount = 0 {product} uintx CMSYoungGenPerWorker = 67108864 {pd product} uintx CMS_FLSPadding = 1 {product} uintx CMS_FLSWeight = 75 {product} uintx CMS_SweepPadding = 1 {product} uintx CMS_SweepTimerThresholdMillis = 10 {product} uintx CMS_SweepWeight = 75 {product} bool CheckEndorsedAndExtDirs = false {product} bool CheckJNICalls = false {product} bool ClassUnloading = true {product} bool ClassUnloadingWithConcurrentMark = true {product} intx ClearFPUAtPark = 0 {product} bool ClipInlining = true {product} uintx CodeCacheExpansionSize = 65536 {pd product} uintx CodeCacheMinimumFreeSpace = 512000 {product} bool CollectGen0First = false {product} bool CompactFields = true {product} intx CompilationPolicyChoice = 3 {product} ccstrlist CompileCommand = {product} ccstr CompileCommandFile = {product} ccstrlist CompileOnly = {product} intx CompileThreshold = 10000 {pd product} bool CompilerThreadHintNoPreempt = true {product} intx CompilerThreadPriority = -1 {product} intx CompilerThreadStackSize = 0 {pd product} uintx CompressedClassSpaceSize = 1073741824 {product} uintx ConcGCThreads = 0 {product} intx ConditionalMoveLimit = 3 {C2 pd product} intx ContendedPaddingWidth = 128 {product} bool ConvertSleepToYield = true {pd product} bool ConvertYieldToSleep = false {product} bool CrashOnOutOfMemoryError = false {product} bool CreateMinidumpOnCrash = false {product} bool CriticalJNINatives = true {product} bool DTraceAllocProbes = false {product} bool DTraceMethodProbes = false {product} bool DTraceMonitorProbes = false {product} bool Debugging = false {product} uintx DefaultMaxRAMFraction = 4 {product} intx DefaultThreadPriority = -1 {product} intx DeferPollingPageLoopCount = -1 {product} intx DeferThrSuspendLoopCount = 4000 {product} bool DeoptimizeRandom = false {product} bool DisableAttachMechanism = false {product} bool DisableExplicitGC = false {product} bool DisplayVMOutputToStderr = false {product} bool DisplayVMOutputToStdout = false {product} bool DoEscapeAnalysis = true {C2 product} bool DontCompileHugeMethods = true {product} bool DontYieldALot = false {pd product} ccstr DumpLoadedClassList = {product} bool DumpReplayDataOnError = true {product} bool DumpSharedSpaces = false {product} bool EagerXrunInit = false {product} intx EliminateAllocationArraySizeLimit = 64 {C2 product} bool EliminateAllocations = true {C2 product} bool EliminateAutoBox = true {C2 product} bool EliminateLocks = true {C2 product} bool EliminateNestedLocks = true {C2 product} intx EmitSync = 0 {product} bool EnableContended = true {product} bool EnableResourceManagementTLABCache = true {product} bool EnableSharedLookupCache = true {product} bool EnableTracing = false {product} uintx ErgoHeapSizeLimit = 0 {product} ccstr ErrorFile = {product} ccstr ErrorReportServer = {product} double EscapeAnalysisTimeout = 20.000000 {C2 product} bool EstimateArgEscape = true {product} bool ExitOnOutOfMemoryError = false {product} bool ExplicitGCInvokesConcurrent = false {product} bool ExplicitGCInvokesConcurrentAndUnloadsClasses = false {product} bool ExtendedDTraceProbes = false {product} ccstr ExtraSharedClassListFile = {product} bool FLSAlwaysCoalesceLarge = false {product} uintx FLSCoalescePolicy = 2 {product} double FLSLargestBlockCoalesceProximity = 0.990000 {product} bool FailOverToOldVerifier = true {product} bool FastTLABRefill = true {product} intx FenceInstruction = 0 {ARCH product} intx FieldsAllocationStyle = 1 {product} bool FilterSpuriousWakeups = true {product} ccstr FlightRecorderOptions = {product} bool ForceNUMA = false {product} bool ForceTimeHighResolution = false {product} intx FreqInlineSize = 325 {pd product} double G1ConcMarkStepDurationMillis = 10.000000 {product} uintx G1ConcRSHotCardLimit = 4 {product} uintx G1ConcRSLogCacheSize = 10 {product} intx G1ConcRefinementGreenZone = 0 {product} intx G1ConcRefinementRedZone = 0 {product} intx G1ConcRefinementServiceIntervalMillis = 300 {product} uintx G1ConcRefinementThreads = 0 {product} intx G1ConcRefinementThresholdStep = 0 {product} intx G1ConcRefinementYellowZone = 0 {product} uintx G1ConfidencePercent = 50 {product} uintx G1HeapRegionSize = 0 {product} uintx G1HeapWastePercent = 5 {product} uintx G1MixedGCCountTarget = 8 {product} intx G1RSetRegionEntries = 0 {product} uintx G1RSetScanBlockSize = 64 {product} intx G1RSetSparseRegionEntries = 0 {product} intx G1RSetUpdatingPauseTimePercent = 10 {product} intx G1RefProcDrainInterval = 10 {product} uintx G1ReservePercent = 10 {product} uintx G1SATBBufferEnqueueingThresholdPercent = 60 {product} intx G1SATBBufferSize = 1024 {product} intx G1UpdateBufferSize = 256 {product} bool G1UseAdaptiveConcRefinement = true {product} uintx GCDrainStackTargetSize = 64 {product} uintx GCHeapFreeLimit = 2 {product} uintx GCLockerEdenExpansionPercent = 5 {product} bool GCLockerInvokesConcurrent = false {product} uintx GCLogFileSize = 8192 {product} uintx GCPauseIntervalMillis = 0 {product} uintx GCTaskTimeStampEntries = 200 {product} uintx GCTimeLimit = 98 {product} uintx GCTimeRatio = 99 {product} uintx HeapBaseMinAddress = 2147483648 {pd product} bool HeapDumpAfterFullGC = false {manageable} bool HeapDumpBeforeFullGC = false {manageable} bool HeapDumpOnOutOfMemoryError = false {manageable} ccstr HeapDumpPath = {manageable} uintx HeapFirstMaximumCompactionCount = 3 {product} uintx HeapMaximumCompactionInterval = 20 {product} uintx HeapSizePerGCThread = 87241520 {product} bool IgnoreEmptyClassPaths = false {product} bool IgnoreUnrecognizedVMOptions = false {product} uintx IncreaseFirstTierCompileThresholdAt = 50 {product} bool IncrementalInline = true {C2 product} uintx InitialBootClassLoaderMetaspaceSize = 4194304 {product} uintx InitialCodeCacheSize = 2555904 {pd product} uintx InitialHeapSize := 134217728 {product} uintx InitialRAMFraction = 64 {product} double InitialRAMPercentage = 1.562500 {product} uintx InitialSurvivorRatio = 8 {product} uintx InitialTenuringThreshold = 7 {product} uintx InitiatingHeapOccupancyPercent = 45 {product} bool Inline = true {product} ccstr InlineDataFile = {product} intx InlineSmallCode = 2000 {pd product} bool InlineSynchronizedMethods = true {C1 product} bool InsertMemBarAfterArraycopy = true {C2 product} intx InteriorEntryAlignment = 16 {C2 pd product} intx InterpreterProfilePercentage = 33 {product} bool JNIDetachReleasesMonitors = true {product} bool JavaMonitorsInStackTrace = true {product} intx JavaPriority10_To_OSPriority = -1 {product} intx JavaPriority1_To_OSPriority = -1 {product} intx JavaPriority2_To_OSPriority = -1 {product} intx JavaPriority3_To_OSPriority = -1 {product} intx JavaPriority4_To_OSPriority = -1 {product} intx JavaPriority5_To_OSPriority = -1 {product} intx JavaPriority6_To_OSPriority = -1 {product} intx JavaPriority7_To_OSPriority = -1 {product} intx JavaPriority8_To_OSPriority = -1 {product} intx JavaPriority9_To_OSPriority = -1 {product} bool LIRFillDelaySlots = false {C1 pd product} uintx LargePageHeapSizeThreshold = 134217728 {product} uintx LargePageSizeInBytes = 0 {product} bool LazyBootClassLoader = true {product} intx LiveNodeCountInliningCutoff = 40000 {C2 product} bool LogCommercialFeatures = false {product} intx LoopMaxUnroll = 16 {C2 product} intx LoopOptsCount = 43 {C2 product} intx LoopUnrollLimit = 60 {C2 pd product} intx LoopUnrollMin = 4 {C2 product} bool LoopUnswitching = true {C2 product} bool ManagementServer = false {product} uintx MarkStackSize = 4194304 {product} uintx MarkStackSizeMax = 536870912 {product} uintx MarkSweepAlwaysCompactCount = 4 {product} uintx MarkSweepDeadRatio = 1 {product} intx MaxBCEAEstimateLevel = 5 {product} intx MaxBCEAEstimateSize = 150 {product} uintx MaxDirectMemorySize = 0 {product} bool MaxFDLimit = true {product} uintx MaxGCMinorPauseMillis = 4294967295 {product} uintx MaxGCPauseMillis = 4294967295 {product} uintx MaxHeapFreeRatio = 100 {manageable} uintx MaxHeapSize := 2126512128 {product} intx MaxInlineLevel = 9 {product} intx MaxInlineSize = 35 {product} intx MaxJNILocalCapacity = 65536 {product} intx MaxJavaStackTraceDepth = 1024 {product} intx MaxJumpTableSize = 65000 {C2 product} intx MaxJumpTableSparseness = 5 {C2 product} intx MaxLabelRootDepth = 1100 {C2 product} intx MaxLoopPad = 11 {C2 product} uintx MaxMetaspaceExpansion = 5451776 {product} uintx MaxMetaspaceFreeRatio = 70 {product} uintx MaxMetaspaceSize = 4294901760 {product} uintx MaxNewSize := 708837376 {product} intx MaxNodeLimit = 75000 {C2 product} uint64_t MaxRAM = 0 {pd product} uintx MaxRAMFraction = 4 {product} double MaxRAMPercentage = 25.000000 {product} intx MaxRecursiveInlineLevel = 1 {product} uintx MaxTenuringThreshold = 15 {product} intx MaxTrivialSize = 6 {product} intx MaxVectorSize = 32 {C2 product} uintx MetaspaceSize = 21807104 {pd product} bool MethodFlushing = true {product} uintx MinHeapDeltaBytes := 524288 {product} uintx MinHeapFreeRatio = 0 {manageable} intx MinInliningThreshold = 250 {product} intx MinJumpTableSize = 10 {C2 pd product} uintx MinMetaspaceExpansion = 339968 {product} uintx MinMetaspaceFreeRatio = 40 {product} uintx MinRAMFraction = 2 {product} double MinRAMPercentage = 50.000000 {product} uintx MinSurvivorRatio = 3 {product} uintx MinTLABSize = 2048 {product} intx MonitorBound = 0 {product} bool MonitorInUseLists = false {product} intx MultiArrayExpandLimit = 6 {C2 product} bool MustCallLoadClassInternal = false {product} uintx NUMAChunkResizeWeight = 20 {product} uintx NUMAInterleaveGranularity = 2097152 {product} uintx NUMAPageScanRate = 256 {product} uintx NUMASpaceResizeRate = 1073741824 {product} bool NUMAStats = false {product} ccstr NativeMemoryTracking = off {product} bool NeedsDeoptSuspend = false {pd product} bool NeverActAsServerClassMachine = false {pd product} bool NeverTenure = false {product} uintx NewRatio = 2 {product} uintx NewSize := 44564480 {product} uintx NewSizeThreadIncrease = 5320 {pd product} intx NmethodSweepActivity = 10 {product} intx NmethodSweepCheckInterval = 5 {product} intx NmethodSweepFraction = 16 {product} intx NodeLimitFudgeFactor = 2000 {C2 product} uintx NumberOfGCLogFiles = 0 {product} intx NumberOfLoopInstrToAlign = 4 {C2 product} intx ObjectAlignmentInBytes = 8 {lp64_product} uintx OldPLABSize = 1024 {product} uintx OldPLABWeight = 50 {product} uintx OldSize := 89653248 {product} bool OmitStackTraceInFastThrow = true {product} ccstrlist OnError = {product} ccstrlist OnOutOfMemoryError = {product} intx OnStackReplacePercentage = 140 {pd product} bool OptimizeFill = true {C2 product} bool OptimizePtrCompare = true {C2 product} bool OptimizeStringConcat = true {C2 product} bool OptoBundling = false {C2 pd product} intx OptoLoopAlignment = 16 {pd product} bool OptoScheduling = false {C2 pd product} uintx PLABWeight = 75 {product} bool PSChunkLargeArrays = true {product} intx ParGCArrayScanChunk = 50 {product} uintx ParGCDesiredObjsFromOverflowList = 20 {product} bool ParGCTrimOverflow = true {product} bool ParGCUseLocalOverflow = false {product} uintx ParallelGCBufferWastePct = 10 {product} uintx ParallelGCThreads = 4 {product} bool ParallelGCVerbose = false {product} uintx ParallelOldDeadWoodLimiterMean = 50 {product} uintx ParallelOldDeadWoodLimiterStdDev = 80 {product} bool ParallelRefProcBalancingEnabled = true {product} bool ParallelRefProcEnabled = false {product} bool PartialPeelAtUnsignedTests = true {C2 product} bool PartialPeelLoop = true {C2 product} intx PartialPeelNewPhiDelta = 0 {C2 product} uintx PausePadding = 1 {product} intx PerBytecodeRecompilationCutoff = 200 {product} intx PerBytecodeTrapLimit = 4 {product} intx PerMethodRecompilationCutoff = 400 {product} intx PerMethodTrapLimit = 100 {product} bool PerfAllowAtExitRegistration = false {product} bool PerfBypassFileSystemCheck = false {product} intx PerfDataMemorySize = 32768 {product} intx PerfDataSamplingInterval = 50 {product} ccstr PerfDataSaveFile = {product} bool PerfDataSaveToFile = false {product} bool PerfDisableSharedMem = false {product} intx PerfMaxStringConstLength = 1024 {product} intx PreInflateSpin = 10 {pd product} bool PreferInterpreterNativeStubs = false {pd product} intx PrefetchCopyIntervalInBytes = 576 {product} intx PrefetchFieldsAhead = 1 {product} intx PrefetchScanIntervalInBytes = 576 {product} bool PreserveAllAnnotations = false {product} bool PreserveFramePointer = false {pd product} uintx PretenureSizeThreshold = 0 {product} bool PrintAdaptiveSizePolicy = false {product} bool PrintCMSInitiationStatistics = false {product} intx PrintCMSStatistics = 0 {product} bool PrintClassHistogram = false {manageable} bool PrintClassHistogramAfterFullGC = false {manageable} bool PrintClassHistogramBeforeFullGC = false {manageable} bool PrintCodeCache = false {product} bool PrintCodeCacheOnCompilation = false {product} bool PrintCommandLineFlags = false {product} bool PrintCompilation = false {product} bool PrintConcurrentLocks = false {manageable} intx PrintFLSCensus = 0 {product} intx PrintFLSStatistics = 0 {product} bool PrintFlagsFinal := true {product} bool PrintFlagsInitial = false {product} bool PrintGC = false {manageable} bool PrintGCApplicationConcurrentTime = false {product} bool PrintGCApplicationStoppedTime = false {product} bool PrintGCCause = true {product} bool PrintGCDateStamps = false {manageable} bool PrintGCDetails = false {manageable} bool PrintGCID = false {manageable} bool PrintGCTaskTimeStamps = false {product} bool PrintGCTimeStamps = false {manageable} bool PrintHeapAtGC = false {product rw} bool PrintHeapAtGCExtended = false {product rw} bool PrintHeapAtSIGBREAK = true {product} bool PrintJNIGCStalls = false {product} bool PrintJNIResolving = false {product} bool PrintOldPLAB = false {product} bool PrintOopAddress = false {product} bool PrintPLAB = false {product} bool PrintParallelOldGCPhaseTimes = false {product} bool PrintPromotionFailure = false {product} bool PrintReferenceGC = false {product} bool PrintSafepointStatistics = false {product} intx PrintSafepointStatisticsCount = 300 {product} intx PrintSafepointStatisticsTimeout = -1 {product} bool PrintSharedArchiveAndExit = false {product} bool PrintSharedDictionary = false {product} bool PrintSharedSpaces = false {product} bool PrintStringDeduplicationStatistics = false {product} bool PrintStringTableStatistics = false {product} bool PrintTLAB = false {product} bool PrintTenuringDistribution = false {product} bool PrintTieredEvents = false {product} bool PrintVMOptions = false {product} bool PrintVMQWaitTime = false {product} bool PrintWarnings = true {product} uintx ProcessDistributionStride = 4 {product} bool ProfileInterpreter = true {pd product} bool ProfileIntervals = false {product} intx ProfileIntervalsTicks = 100 {product} intx ProfileMaturityPercentage = 20 {product} bool ProfileVM = false {product} bool ProfilerPrintByteCodeStatistics = false {product} bool ProfilerRecordPC = false {product} uintx PromotedPadding = 3 {product} uintx QueuedAllocationWarningCount = 0 {product} uintx RTMRetryCount = 5 {ARCH product} bool RangeCheckElimination = true {product} intx ReadPrefetchInstr = 0 {ARCH product} bool ReassociateInvariants = true {C2 product} bool ReduceBulkZeroing = true {C2 product} bool ReduceFieldZeroing = true {C2 product} bool ReduceInitialCardMarks = true {C2 product} bool ReduceSignalUsage = false {product} intx RefDiscoveryPolicy = 0 {product} bool ReflectionWrapResolutionErrors = true {product} bool RegisterFinalizersAtInit = true {product} bool RelaxAccessControlCheck = false {product} ccstr ReplayDataFile = {product} bool RequireSharedSpaces = false {product} uintx ReservedCodeCacheSize = 251658240 {pd product} bool ResizeOldPLAB = true {product} bool ResizePLAB = true {product} bool ResizeTLAB = true {pd product} bool RestoreMXCSROnJNICalls = false {product} bool RestrictContended = true {product} bool RewriteBytecodes = true {pd product} bool RewriteFrequentPairs = true {pd product} intx SafepointPollOffset = 256 {C1 pd product} intx SafepointSpinBeforeYield = 2000 {product} bool SafepointTimeout = false {product} intx SafepointTimeoutDelay = 10000 {product} bool ScavengeBeforeFullGC = true {product} intx SelfDestructTimer = 0 {product} uintx SharedBaseAddress = 0 {product} ccstr SharedClassListFile = {product} uintx SharedMiscCodeSize = 122880 {product} uintx SharedMiscDataSize = 4194304 {product} uintx SharedReadOnlySize = 16777216 {product} uintx SharedReadWriteSize = 16777216 {product} bool ShowMessageBoxOnError = false {product} intx SoftRefLRUPolicyMSPerMB = 1000 {product} bool SpecialEncodeISOArray = true {C2 product} bool SplitIfBlocks = true {C2 product} intx StackRedPages = 1 {pd product} intx StackShadowPages = 6 {pd product} bool StackTraceInThrowable = true {product} intx StackYellowPages = 3 {pd product} bool StartAttachListener = false {product} intx StarvationMonitorInterval = 200 {product} bool StressLdcRewrite = false {product} uintx StringDeduplicationAgeThreshold = 3 {product} uintx StringTableSize = 60013 {product} bool SuppressFatalErrorMessage = false {product} uintx SurvivorPadding = 3 {product} uintx SurvivorRatio = 8 {product} intx SuspendRetryCount = 50 {product} intx SuspendRetryDelay = 5 {product} intx SyncFlags = 0 {product} ccstr SyncKnobs = {product} intx SyncVerbose = 0 {product} uintx TLABAllocationWeight = 35 {product} uintx TLABRefillWasteFraction = 64 {product} uintx TLABSize = 0 {product} bool TLABStats = true {product} uintx TLABWasteIncrement = 4 {product} uintx TLABWasteTargetPercent = 1 {product} uintx TargetPLABWastePct = 10 {product} uintx TargetSurvivorRatio = 50 {product} uintx TenuredGenerationSizeIncrement = 20 {product} uintx TenuredGenerationSizeSupplement = 80 {product} uintx TenuredGenerationSizeSupplementDecay = 2 {product} intx ThreadPriorityPolicy = 0 {product} bool ThreadPriorityVerbose = false {product} uintx ThreadSafetyMargin = 52428800 {product} intx ThreadStackSize = 0 {pd product} uintx ThresholdTolerance = 10 {product} intx Tier0BackedgeNotifyFreqLog = 10 {product} intx Tier0InvokeNotifyFreqLog = 7 {product} intx Tier0ProfilingStartPercentage = 200 {product} intx Tier23InlineeNotifyFreqLog = 20 {product} intx Tier2BackEdgeThreshold = 0 {product} intx Tier2BackedgeNotifyFreqLog = 14 {product} intx Tier2CompileThreshold = 0 {product} intx Tier2InvokeNotifyFreqLog = 11 {product} intx Tier3BackEdgeThreshold = 60000 {product} intx Tier3BackedgeNotifyFreqLog = 13 {product} intx Tier3CompileThreshold = 2000 {product} intx Tier3DelayOff = 2 {product} intx Tier3DelayOn = 5 {product} intx Tier3InvocationThreshold = 200 {product} intx Tier3InvokeNotifyFreqLog = 10 {product} intx Tier3LoadFeedback = 5 {product} intx Tier3MinInvocationThreshold = 100 {product} intx Tier4BackEdgeThreshold = 40000 {product} intx Tier4CompileThreshold = 15000 {product} intx Tier4InvocationThreshold = 5000 {product} intx Tier4LoadFeedback = 3 {product} intx Tier4MinInvocationThreshold = 600 {product} bool TieredCompilation = true {pd product} intx TieredCompileTaskTimeout = 50 {product} intx TieredRateUpdateMaxTime = 25 {product} intx TieredRateUpdateMinTime = 1 {product} intx TieredStopAtLevel = 4 {product} bool TimeLinearScan = false {C1 product} bool TraceBiasedLocking = false {product} bool TraceClassLoading = false {product rw} bool TraceClassLoadingPreorder = false {product} bool TraceClassPaths = false {product} bool TraceClassResolution = false {product} bool TraceClassUnloading = false {product rw} bool TraceDynamicGCThreads = false {product} bool TraceGen0Time = false {product} bool TraceGen1Time = false {product} ccstr TraceJVMTI = {product} bool TraceLoaderConstraints = false {product rw} bool TraceMetadataHumongousAllocation = false {product} bool TraceMonitorInflation = false {product} bool TraceParallelOldGCTasks = false {product} intx TraceRedefineClasses = 0 {product} bool TraceSafepointCleanupTime = false {product} bool TraceSharedLookupCache = false {product} bool TraceSuspendWaitFailures = false {product} intx TrackedInitializationLimit = 50 {C2 product} bool TransmitErrorReport = false {product} bool TrapBasedNullChecks = false {pd product} bool TrapBasedRangeChecks = false {C2 pd product} intx TypeProfileArgsLimit = 2 {product} uintx TypeProfileLevel = 111 {pd product} intx TypeProfileMajorReceiverPercent = 90 {C2 product} intx TypeProfileParmsLimit = 2 {product} intx TypeProfileWidth = 2 {product} intx UnguardOnExecutionViolation = 0 {product} bool UnlinkSymbolsALot = false {product} bool Use486InstrsOnly = false {ARCH product} bool UseAES = true {product} bool UseAESIntrinsics = true {product} intx UseAVX = 2 {ARCH product} bool UseAdaptiveGCBoundary = false {product} bool UseAdaptiveGenerationSizePolicyAtMajorCollection = true {product} bool UseAdaptiveGenerationSizePolicyAtMinorCollection = true {product} bool UseAdaptiveNUMAChunkSizing = true {product} bool UseAdaptiveSizeDecayMajorGCCost = true {product} bool UseAdaptiveSizePolicy = true {product} bool UseAdaptiveSizePolicyFootprintGoal = true {product} bool UseAdaptiveSizePolicyWithSystemGC = false {product} bool UseAddressNop = true {ARCH product} bool UseAltSigs = false {product} bool UseAutoGCSelectPolicy = false {product} bool UseBMI1Instructions = true {ARCH product} bool UseBMI2Instructions = true {ARCH product} bool UseBiasedLocking = true {product} bool UseBimorphicInlining = true {C2 product} bool UseBoundThreads = true {product} bool UseCLMUL = true {ARCH product} bool UseCMSBestFit = true {product} bool UseCMSCollectionPassing = true {product} bool UseCMSCompactAtFullCollection = true {product} bool UseCMSInitiatingOccupancyOnly = false {product} bool UseCRC32Intrinsics = true {product} bool UseCodeCacheFlushing = true {product} bool UseCompiler = true {product} bool UseCompilerSafepoints = true {product} bool UseCompressedClassPointers := true {lp64_product} bool UseCompressedOops := true {lp64_product} bool UseConcMarkSweepGC = false {product} bool UseCondCardMark = false {C2 product} bool UseCountLeadingZerosInstruction = true {ARCH product} bool UseCountTrailingZerosInstruction = true {ARCH product} bool UseCountedLoopSafepoints = false {C2 product} bool UseCounterDecay = true {product} bool UseDivMod = true {C2 product} bool UseDynamicNumberOfGCThreads = false {product} bool UseFPUForSpilling = true {C2 product} bool UseFastAccessorMethods = false {product} bool UseFastEmptyMethods = false {product} bool UseFastJNIAccessors = true {product} bool UseFastStosb = true {ARCH product} bool UseG1GC = false {product} bool UseGCLogFileRotation = false {product} bool UseGCOverheadLimit = true {product} bool UseGCTaskAffinity = false {product} bool UseGHASHIntrinsics = true {product} bool UseHeavyMonitors = false {product} bool UseInlineCaches = true {product} bool UseInterpreter = true {product} bool UseJumpTables = true {C2 product} bool UseLWPSynchronization = true {product} bool UseLargePages = false {pd product} bool UseLargePagesInMetaspace = false {product} bool UseLargePagesIndividualAllocation := false {pd product} bool UseLockedTracing = false {product} bool UseLoopCounter = true {product} bool UseLoopInvariantCodeMotion = true {C1 product} bool UseLoopPredicate = true {C2 product} bool UseMathExactIntrinsics = true {C2 product} bool UseMaximumCompactionOnSystemGC = true {product} bool UseMembar = false {pd product} bool UseMontgomeryMultiplyIntrinsic = true {C2 product} bool UseMontgomerySquareIntrinsic = true {C2 product} bool UseMulAddIntrinsic = true {C2 product} bool UseMultiplyToLenIntrinsic = true {C2 product} bool UseNUMA = false {product} bool UseNUMAInterleaving = false {product} bool UseNewLongLShift = false {ARCH product} bool UseOSErrorReporting = false {pd product} bool UseOldInlining = true {C2 product} bool UseOnStackReplacement = true {pd product} bool UseOnlyInlinedBimorphic = true {C2 product} bool UseOptoBiasInlining = true {C2 product} bool UsePSAdaptiveSurvivorSizePolicy = true {product} bool UseParNewGC = false {product} bool UseParallelGC := true {product} bool UseParallelOldGC = true {product} bool UsePerfData = true {product} bool UsePopCountInstruction = true {product} bool UseRDPCForConstantTableBase = false {C2 product} bool UseRTMDeopt = false {ARCH product} bool UseRTMLocking = false {ARCH product} bool UseSHA = false {product} bool UseSHA1Intrinsics = false {product} bool UseSHA256Intrinsics = false {product} bool UseSHA512Intrinsics = false {product} intx UseSSE = 4 {product} bool UseSSE42Intrinsics = true {product} bool UseSerialGC = false {product} bool UseSharedSpaces = false {product} bool UseSignalChaining = true {product} bool UseSquareToLenIntrinsic = true {C2 product} bool UseStoreImmI16 = false {ARCH product} bool UseStringDeduplication = false {product} bool UseSuperWord = true {C2 product} bool UseTLAB = true {pd product} bool UseThreadPriorities = true {pd product} bool UseTypeProfile = true {product} bool UseTypeSpeculation = true {C2 product} bool UseUTCFileTimestamp = true {product} bool UseUnalignedLoadStores = true {ARCH product} bool UseVMInterruptibleIO = false {product} bool UseXMMForArrayCopy = true {product} bool UseXmmI2D = false {ARCH product} bool UseXmmI2F = false {ARCH product} bool UseXmmLoadAndClearUpper = true {ARCH product} bool UseXmmRegToRegMoveAll = true {ARCH product} bool VMThreadHintNoPreempt = false {product} intx VMThreadPriority = -1 {product} intx VMThreadStackSize = 0 {pd product} intx ValueMapInitialSize = 11 {C1 product} intx ValueMapMaxLoopSize = 8 {C1 product} intx ValueSearchLimit = 1000 {C2 product} bool VerifyMergedCPBytecodes = true {product} bool VerifySharedSpaces = false {product} intx WorkAroundNPTLTimedWaitHang = 1 {product} uintx YoungGenerationSizeIncrement = 20 {product} uintx YoungGenerationSizeSupplement = 80 {product} uintx YoungGenerationSizeSupplementDecay = 8 {product} uintx YoungPLABSize = 4096 {product} bool ZeroTLAB = false {product} intx hashCode = 5 {product} java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
E:\workspace\study-guigu>java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=132899584 -XX:MaxHeapSize=2126393344 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAl
location -XX:+UseParallelGC
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
-Xms:初始化大小内存,默认为物理内存1/64。(等价于-XX:InitialHeapSize)
-Xmx:最大分配内存,默认为物理内存1/4。(等价于-XX:MaxHeapSize)
-Xss:设置单个线程栈的大小,一般默认为512k~1024k。(等价于-XX:ThreadStackSize)
-Xmn:设置年轻代大小
-XX:MetaspaceSize:元空间的本质和永久代类似,都是对JVM规范中方法区的实现。不过元空间于永久代之间最大的区别在于:**元空间并不在虚拟机中,而是使用本地内存。**因此默认情况下,元空间的大小仅受本地内存限制。
-Xms128m -Xmx4096m -Xss1024k -XX:MetaspaceSize=512m -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseSerialGC
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。