rmi中的java潜在内存泄漏
我们有一个通过JMX监控的服务。JVM堆的使用率正在增长,即使是主要的集合也无法移除垃圾。检查堆会显示由RMI相关引用(如果不是全部的话,也大部分是相关的类装入器)组成的垃圾。缓解这个问题的唯一方法是通过JMX发出显式gc调用(这将删除所有累积的垃圾)。我们的gc相关选项包括:
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:SurvivorRatio=8
-XX:MaxTenuringThreshold=1
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
我们没有触及其中任何一个:DisableExplicitGC或sun。rmi。dgc。服务器gcInterval
我相信这个问题应该通过sun的代码来解决。杂项。GC。守护进程:
public void run() {
for (;;) {
long l;
synchronized (lock) {
l = latencyTarget;
if (l == NO_TARGET) {
/* No latency target, so exit */
GC.daemon = null;
return;
}
long d = maxObjectInspectionAge();
if (d >= l) {
/* Do a full collection. There is a remote possibility
* that a full collection will occurr between the time
* we sample the inspection age and the time the GC
* actually starts, but this is sufficiently unlikely
* that it doesn't seem worth the more expensive JVM
* interface that would be required.
*/
System.gc();
d = 0;
}
/* Wait for the latency period to expire,
* or for notification that the period has changed
*/
try {
lock.wait(l - d);
} catch (InterruptedException x) {
continue;
}
}
}
}
由于某种原因,上述系统。没有调用gc(这已通过查看gc日志进行验证)。有人对如何解决这个问题有什么建议吗
共 (0) 个答案