[英]How do I avoid jvm running compiler threads in the jvm container
如何避免jvm在jvm容器中運行編譯器線程。
"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007fb2980cc000 nid=0x440e waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007fb2980be800 nid=0x440d waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
這些線程來自熱點編譯器。 如果要在線程轉儲中刪除它們,請以java -Xint ...
啟動應用程序。
請注意,此后可能會運行緩慢。 ;-)
編輯以使其清楚。 禁用JIT編譯器不是您要執行的操作。 然后,字節碼以interpreted
模式執行,而不是平台的已compiled code for your plattform
。 請參閱Java選項
示范小片段
public class Jit {
public static void main(String[] args) {
long start = System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 10_000_000; i++) {
sb.append(' ');
}
long end = System.currentTimeMillis();
System.out.println("length = " + sb.length());
System.out.println("duration: " + (end - start));
}
}
以混合模式運行(按需編譯)
java Jit
length = 10000000
duration: 124
以解釋模式運行
java -Xint Jit
length = 10000000
duration: 3495
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.