How to manually force a full garbage collection in Confluence
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
While we do not recommend manually tuning Garbage Collection (GC) properties, manually forcing a full GC when testing memory adjustments in a development environment may become necessary.
Solution
First, you will need to run Confluence through a JDK from Java version 8 or higher. In Java 8+ JDK, the jcmd utility is accessed and used to initiate the full garbage collection. (You can find this command under your $JDK_HOME/bin/)
Run a jcmd command to reveal all processes and their PIDS currently running on Confluence
1
jcmd
Review the output of processes and notate the PID located for a process running under Tomcat Catalina. In the following example the PID is 12345
1
12345 org.apache.catalina.startup.Bootstrap start
Using the PID from step 3., run the following command (where xxxx is PID) to trigger the full GC:
1
jcmd xxxx GC.run
The process should run and generate the following execution message:
1
Command executed successfully
Was this helpful?