简体   繁体   中英

Can Java RMI remote objects be garbage-collected in a minor collection?

It is well known that RMI periodically calls System.gc() in order to cause a full gc, which will make sure that any unreferenced remote objects are collected. However, I have not been able to find out whether remote objects may sometimes be garbage-collected in a minor collection. For example, if the RMI communication is extremely low-latency and the client lease period accordingly extremely short. Or is a full gc always required? If so, why? Are remote objects perhaps not even created in Eden space, but immediately enter the tenured generation?

Yes. Remote objects are no different from any other objects for the purposes of garbage collection.

The DGC protocol is merely imposed on top of GC, by holding references until the DGC leases expire.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM