spurious reportings of System.gc()???

Alan Bateman Alan.Bateman at oracle.com
Fri Apr 4 11:14:07 UTC 2014


On 04/04/2014 11:28, Per Liden wrote:
>
> There are at least two uses of System.gc() inside the JDK itself. The 
> first case is heavy use of ByteBuffer.allocateDirect(), which could 
> cause a System.gc() if reference processing isn't keeping up and 
> you're bumping into the MaxDirectMemorySize limit. I think the other 
> case is heavy use of FileChannel.transferFrom/To(). Maybe that's what 
> you're seeing?
I suspect you meant FileChannel.map rather than the transferXXX methods 
(the transfer methods do use memory mapping for some cases but they 
unmap so the memory doesn't increase). One thing to mention here is that 
direct and mapped buffers have instrumentation so if this is JDK 7 or 
newer then their usage can be monitored with JMX tools.

The other one that comes up periodically is RMI as the distributed GC 
does result in explicit calls to System.gc, Kirk probably knows about 
that one.

-Alan.


More information about the hotspot-dev mailing list