The Java Virtual Machine supports several garbage collection strategies.
This article explains them.
Now I am wondering which (automatically selected) strategy my application is using, is there any way to let the JVM(version 1.6) print this information?
Edit: The JVM detects if it is in client or server mode. So the question really is how can I see which has been detected?
Looks like, we have more convenient way to define the version of
GC
at runtime. Always use tools, my suggestion. To define GC version we need two tools that come with JVM (placed in yourjdk/bin
directory):VisualVM
- start it and try to profile some process (for example you can profile VisualVM itself). Your profile will show you a PID of process (see the green rectangles at a screenshot).jMap
- start this tool with-heap <PID>
options and find a string dedicated to a Garbage Collector type (see a pink line at a screenshot)