Can the G1 garbage collector be used when System.gc() is called

In Hotspot, when System.gc() is invoked, I can have this use the Concurrent-Mark-Sweep collector by adding the -XX:+ExplicitGCInvokesConcurrent option to the command line.

Is there anything equivalent to make the JVM use the G1 collector when System.gc() is invoked? By default, the standard parallel collector appears to be used.

I'm guessing not, but I just wondered if anyone could confirm.

Don't worry! I'm not planning to invoke System.gc() myself, but there are parts of the JVM (direct buffers, RMI) that rely on it being called.

Answers


From this bug post :

G1 now observes ExplicitGCInvokesConcurrent

there is also this link that confirm it.

AFAIK there is no special command, neither the list of Oracle JVM options nor this longer list refer such command option.


bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
  switch (cause) {
    case GCCause::_gc_locker:               return GCLockerInvokesConcurrent;
    case GCCause::_java_lang_system_gc:     return ExplicitGCInvokesConcurrent;
    case GCCause::_g1_humongous_allocation: return true;
    default:                                return false;

} }

And

bool ExplicitGCInvokesConcurrent = false {product}


Need Your Help

Changing color of labels in JFreeChart

java jfreechart

Anybody that has experience using JFreeChart, is there a way to change the color of my labels for my XY axes. Right now I'm using a XYPlot and I want to change the color of the labels on my axes. Is

File write, without deleting old lines?

c++ fwrite

I currently have this to write to a file in my program. I have all the variables ready to put into the file I just have an issue.