𝗧𝘆𝗽𝗲𝘀 𝗢𝗳 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿𝘀 𝗜𝗻 𝗝𝗮𝘃𝗮
𝗧𝘆𝗽𝗲𝘀 𝗢𝗳 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿𝘀 𝗜𝗻 𝗝𝗮𝘃𝗮
========================
There are total 7 types of garbage collectors available in Java.
𝟭) 𝗦𝗲𝗿𝗶𝗮𝗹 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿
Single thread performs all GC work, application is paused during GC, medium throughput with high pause time, suitable for small applications with limited memory (<100MB)
𝟮) 𝗣𝗮𝗿𝗮𝗹𝗹𝗲𝗹 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿
Multiple threads share GC work, application is paused during GC but it is minimal as multiple threads collect garbage in parallel, high throughput with medium pause time, suitable for applications with medium to large heap memory (in GBs).
𝟯) 𝗖𝗼𝗻𝗰𝘂𝗿𝗿𝗲𝗻𝘁 𝗠𝗮𝗿𝗸-𝗦𝘄𝗲𝗲𝗽 (𝗖𝗠𝗦) 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿 (𝗗𝗲𝗽𝗿𝗲𝗰𝗮𝘁𝗲𝗱 𝘀𝗶𝗻𝗰𝗲 𝗝𝗮𝘃𝗮 𝟵)
Most of GC work is done concurrently with application threads thus reduces pause time further, High throughput with low pause time, suitable for appliactions with medium to large heap memory with need of low pause time during GC.
𝟰) 𝗚𝗮𝗿𝗯𝗮𝗴𝗲-𝗙𝗶𝗿𝘀𝘁 (𝗚𝟭) 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿
Divides the heap memory into multiple regions of equal size and regions with most garbage are garbage collected first, Most of GC work is done concurrently with application, high throughput with pause time within user specified target, suitable for applications with large heap memory (4GB+).
𝟱) 𝗭 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿
Divides the heap memory into multiple regions of variable size, performs all of GC work concurrently with application, high throughput with ultra-low pause time, Suitable for real time applications with want consistent response time with massive heap memory (In TBs).
𝟲) 𝗦𝗵𝗲𝗻𝗮𝗻𝗱𝗼𝗮𝗵 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿
Very much similar to Z GC, high throughput with ultra-low pause time, suitable for applications which want consistent and extremely low pause time irrespective of heap memory.
𝟳) 𝗘𝗽𝘀𝗶𝗹𝗼𝗻 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗼𝗿
Do-Nothing garbage collector, Allocates memory but never reclaims it, maximum throughput with zero pause time as it doesn't collect garbage, used for performance testing.
Comments
Post a Comment