RMI calls the System.gc() in case there are distributed objects which need to be cleaned up. You can make it perform GC less often or effectively turn it off.
You can avoid direct ByteBuffer needing a GC to clean them up on the Sun/Oracle JVM by calling
ByteBuffer bb = ByteBuffer.allocateDirect(SIZE);
((DirectBuffer) bb).cleaner().clean();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…