Search code examples
javagarbage-collection

ParallelRefProcEnabled Default Number of Threads


What are default number of threads the JVM assigns when the option -XX:+ParallelRefProcEnabled ? Is there a way we can control the number of threads that do reference processng? If yes, what is the parameter to do this?


Solution

  • ParallelGCThreads controls the parallelism of all stop-the-world GC phases, which should include parallel reference processing.

    Its default is calculated based on your current machine, you can see it via

    java -XX:+Use????GC -XX:+PrintFlagsFinal | grep ParallelGCThreads
    

    (fill in the GC you're using, defaults may vary)

    Note that GC reference processing is not the same as finalization or Cleaner execution, which happens outside GC pauses.