本文介绍了Java垃圾收集日志条目是否为“Full GC(System)”?意思是一些叫做System.gc()的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

垃圾收集日志中的Full GC(System)条目是什么意思?那个叫做System.gc()的类?



我的垃圾回收日志有两种不同的'full gc'入口类型?一个用'System'一词,另一个没有。有什么不同?



(更新:我搜索了这个词,但没有找到明确的答案,只有几个问题,所以我想我会发布它) 。



系统

无系统
$ b

GC选项



我们的gc相关的java内存选项是:
-Xloggc:../ server / pe / log / jvm_gc.log -XX:+ PrintGCTimeStamps -XX:+ PrintGCDetails

我们不'-XX:+ DisableExplicitGC',所以有可能是一些错误的类调用了System.gc()



fwiw,这是我们完整的jvm选项:
$ b

/ p>

will

解决方案

从OpenJDK的源代码来看,

  const bool is_system_gc = gc_cause == GCCause :: _ java_lang_system_gc; 

//这对于调试很有用,但不要改变
//客户看到的输出。
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


What does "Full GC (System)" entry in the garbage collection logs mean? That some class called System.gc() ?

My garbage collection logs has two different entry types for 'full gc'? One with the word 'System', the other without. What's the difference?

(Update: I searched on this term and didn't find a definitive answer, only a few questions. So I thought I'd post it).

System:

No-System:

GC Options

Our gc-related java memory options are:-Xloggc:../server/pe/log/jvm_gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails

We do not '-XX:+DisableExplicitGC', so it's possible some errant class does call System.gc()

fwiw, our full jvm options:

thanks in advance,

will

解决方案

From the source for OpenJDK I would say it is

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)";
}

I created a custom version of the Runtime class to record the thread name and stack trace to a file whenever Runtime.getRuntime().gc() was called. (System.gc() calls this) I found it useful in tracking down and removing such callers.

One place this happens is in sun.misc.GC class. The RMI will ask this class to ensure a GC has been performing in the last N seconds. If there has been no GC it triggers a full GC.

This only shows as a problem if you reduce the number of minor GCs. Ironicly it can mean you get more full GCs. ;)

I don't use RMI (except perhaps JConsole) So I have it set to a week. (Think the default is an hour)

-Dsun.rmi.dgc.server.gcInterval=604800000
-Dsun.rmi.dgc.client.gcInterval=604800000

这篇关于Java垃圾收集日志条目是否为“Full GC(System)”?意思是一些叫做System.gc()的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 02:30