Search code examples
javagarbage-collectionheap-memoryconcurrent-mark-sweep

java GC algorithm fine tuning : CMS algorithm alone & combination


Currently I am using a combination of CMS and ParNewGC

-XX:+UseConcMarkSweepGC -XX:+UseParNewGC

As per my understanding, CMS is used for Old Gen GC and UserPareNewGC used for you gen garbage collection.

If I pass only CMS as single parameter, -XX:+UseConcMarkSweepGC, is CMS used for garbage collection of both young gen and Old Gen?

I think that UseParNewGC still used for young gen even though it has not been configured along with CMS. But I want to confirm the assumption.

Am I right?

EDIT: I am using JDK 1.7 version. If behaviour is different in 1.7 and 1.8, please explain.


Solution

  • When asking gc questions you should state what version of the jdk you are wondering about since the actual combination varies from version to version. But, CMS is only used with tenured generation, never with young generation. Parallell New Gen scavenge will be used.