The garbage collector in any Java application is automatic and I'm pretty sure it cannot be instructed or triggered through a specific command.
Do you have an idea on what could cause the build up that's clearly visible in your chart? What caused the three dips? The JVM apparently has a reason to keep certain things in memory. Finding out what that reason is and removing it (if this of course doesn't break anything) is probably the way to go here.
You can use jconsole.exe which offers the button “Perform GC” on its memory tab. This calls System.gc() which gently suggests that the Garbage Collector will run. As Wiemer already stated, there is no guarantee that the GC will run. You’ll find jconsole.exe in your AdoptOpenJDK installation path in the bin directory.
I wonder if using a tool like APD or AQM would help show what’s happening in your application to use that much memory.
If you’re eager to investigate this, there are hardcore methods to do so. Try dumping the heap memory space and analyzing it.
AQM does static code analysis. So it’s not useful in this case since it’s a runtime behavior issue. APD on the other hand could help.
https://mlsdev.com/blog/healthcare-mobile-app-development is a leading app software development company with a variety of services to help you succeed with your business. They can help you develop a mobile application that works for your audience. You'll never regret hiring an app software development company. They will ensure that your project is launched and maintained properly. And their teams will continue to support it for you long after it's released, which is very important. A great app developer can be a major asset to your business.