Is there a means of forcing GC baked in?

Questions about YourKit Java Profiler
Post Reply
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

Is there a means of forcing GC baked in?

Post by Michael.Scaman »

Is it part of either the CLI or the Controller api?

Is there a recommended way? Or do users roll their own using jcmd, a utility jar, or System.gc?
It would be nice if there was a simple way baked into the product
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Is there a means of forcing GC baked in?

Post by Anton Katilin »

The recommended way to deal with GC is to let the JVM decide when and whether to run it. Modern JVMs do not need user's assistance in this regard.

Anyway, you may force GC if you want to. Use any tool you like, the result will be the same:

- the profiler UI has a dedicated toolbar button;
- the profiler API class Controller has method forceGC() (but the command line tool does not have a command for this);
- you can use standard tools like jconsole, etc.
Post Reply