Skip to Main Content

Java APIs


For appeals, questions and feedback about Oracle Forums, please email Please ask technical questions in the appropriate category. Thank you!

Potential Memory Leak in rmi

1050487Oct 25 2013

We have a service that is being monitored via JMX. The JVM heap usage is growing and even major collections are not able to remove the garbage. Inspecting the heap shows garbage consisting of RMI related references (mostly, if not all, related class loaders). The only way to alleviate the issue is to issue explicit gc call through JMX (that removes all accumulated garbage). Our gc related options are:

-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly

And we have not touched either of: DisableExplicitGC or sun.rmi.dgc.server.gcInterval

I believe the problem is supposed to addressed by the code in sun.misc.GC.Daemon:

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

For some reason the above System.gc is not being invoked (that has been verified by looking at gc logs). Anyone has a suggestion as to how to address the issue?

Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2013
Added on Oct 25 2013