从OpenJDK的来源我会说是
const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;// This is useful for debugging but don't change the output the// the customer sees.const char* gc_cause_str = "Full GC";if (is_system_gc && PrintGCDetails) { gc_cause_str = "Full GC (System)";}我创建了Runtime类的自定义版本,以便在调用Runtime.getRuntime()。gc()时将线程名称和堆栈跟踪记录到文件中。(System.gc()称为此函数)我发现它对于跟踪和删除此类调用者很有用。
发生这种情况的一个地方是在sun.misc.GC类中。RMI将要求该类确保GC在最近N秒内一直在执行。如果没有GC,则会触发完整的GC。
仅当减少次要GC的数量时,这才显示为问题。具有讽刺意味的是,这可能意味着您可以获得更多完整的GC。;)
我不使用RMI(也许JConsole除外),所以我将其设置为一周。(认为默认值为一个小时)
-Dsun.rmi.dgc.server.gcInterval=604800000-Dsun.rmi.dgc.client.gcInterval=604800000



