[Mono-list] Garbage-collecting a remoting singleton object in a service?

"Andrés G. Aragoneses [ knocte ] "Andrés G. Aragoneses [ knocte ]
Mon Sep 4 06:38:06 EDT 2006

Thanks for your answer Robert!

> That's not the real reason why they are GCed. If an object
> is casted to one of its interface it still remains the
> same object.
> If the client is implementing IClient while subclassing
> MarshalByRefObject, the usual remoting lifetime constraints
> will take effect.
> You can control the lifetime (on the client) by overriding
> InitializeLifetimeServices.

I see. But I am using also a null value for the return value of 
InitializeLifetimeService in the client, because I want the client to 
keep connected until normal program termination (or CTRL-C hitted by the 
user at the client machine), which will actually garbage collect the 
whole process.


class Client : MarshalByRefObject, IClient
   public override object InitializeLifetimeService()
     return null;

   /* methods of IClient interface... */

> The IClient proxy (on the server) is subject to be GCed after
> it's removed from the hClients dictionary

That's the thing I was unsure about, thanks for pointing out!


	Andrés	[ knocte ]


More information about the Mono-list mailing list