代碼
public static void main(String[] args) { for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) { long count = gc.getCollectionCount(); long time = gc.getCollectionTime(); String name = gc.getName(); System.out.println(String.format("%s: %s times %s ms", name, count, time)); } }結果
一個young generation collector和一個old generation collector
PS Scavenge: 0 times 0 ms PS MarkSweep: 0 times 0 msYoung generation collectors
the serial copy collector, uses one thread to copy surviving objects from Eden to Survivor spaces and between Survivor spaces until it decides they"ve been there long enough, at which point it copies them into the old generation.
the parallel scavenge collector, like the Copy collector, but uses multiple threads in parallel and has some knowledge of how the old generation is collected (essentially written to work with the serial and PS old gen collectors).
the parallel copy collector, like the Copy collector, but uses multiple threads in parallel and has an internal "callback" that allows an old generation collector to operate on the objects it collects (really written to work with the concurrent collector).
the garbage first collector, uses the "Garbage First" algorithm which splits up the heap into lots of smaller spaces, but these are still separated into Eden and Survivor spaces in the young generation for G1.
Old generation collectorsthe serial mark-sweep collector, the daddy of them all, uses a serial (one thread) full mark-sweep garbage collection algorithm, with optional compaction.
the parallel scavenge mark-sweep collector, parallelised version (i.e. uses multiple threads) of the MarkSweepCompact.
the concurrent collector, a garbage collection algorithm that attempts to do most of the garbage collection work in the background without stopping application threads while it works (there are still phases where it has to stop application threads, but these phases are attempted to be kept to a minimum). Note if the concurrent collector fails to keep up with the garbage, it fails over to the serial MarkSweepCompact collector for (just) the next GC.
the garbage first collector, uses the "Garbage First" algorithm which splits up the heap into lots of smaller spaces.
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/76336.html
摘要:原文鏈接這是專家系列文章的第二篇。運行在本地虛擬機上的應用的又稱為,通常與相同。性能數據需要持續觀察,因此在運行時需要定時輸出的監控信息。新生代容量的統計信息。是提供的一個式的圖表監控工具。 原文鏈接:http://www.cubrid.org/blog/dev-platform/how-to-monitor-java-garbage-collection/ 這是GC專家系列文章的第二...
摘要:原文鏈接本篇是專家系列的第三篇。但是,請記住調優是不得已時的選擇。縮短耗時的單次執行與相比,耗時有較明顯的增加。創建文件過程中,進程會中斷,因此不要在正常運行時系統上做此操作。因此校驗結果并根據具體的服務需要,決定是否要進行調優。 原文鏈接:http://www.cubrid.org/blog/dev-platform/how-to-tune-java-garbage-collecti...
摘要:此前滴滴出行安卓端曾長期受此的影響,每天有一些用戶會因此遇到,經過深度分析,最終找到有效解決方案。方法內盡量減少耗時以及線程同步時間。減少高優先級線程的創建和使用,降低高優先級線程的使用率。出品 | 滴滴技術作者 | 江義旺showImg(https://user-gold-cdn.xitu.io/2019/5/15/16ab95686cf247c1);前言:隨著安卓 APP 規模越來越大,...
摘要:虛擬機性能監控與故障處理工具詳解概述本文參考的是周志明的深入理解虛擬機第四章,為了整理思路,簡單記錄一下,方便后期查閱。虛擬機堆轉儲快照分析工具功能用于分析生成的。 虛擬機性能監控與故障處理工具 詳解 4.1 概述 本文參考的是周志明的 《深入理解Java虛擬機》 第四章 ,為了整理思路,簡單記錄一下,方便后期查閱。 JDK本身提供了很多方便的JVM性能調優監控工具,除了集成式的Vis...
摘要:的字節碼解釋器和編譯器使用寫屏障維護卡表。解釋器每次執行更新引用的字節碼時,都會執行一段寫屏障,編譯器在生成更新引用的代碼后,也會生成一段寫屏障。 4. JVM 4.1 GC 1. 垃圾收集 基礎 : 可達性分析算法 GC ROOTS 復制算法 標記清除 標記整理 分代收集 -- 1. 新生代 ; 2.3 老年代注: Oop Map -- 安全點 -- 安全區 以下部分內容 來自 ...
閱讀 3011·2021-10-27 14:15
閱讀 2999·2021-09-07 10:18
閱讀 1320·2019-08-30 15:53
閱讀 1570·2019-08-26 18:18
閱讀 3373·2019-08-26 12:15
閱讀 3460·2019-08-26 10:43
閱讀 654·2019-08-23 16:43
閱讀 2207·2019-08-23 15:27