简体   繁体   中英

.NET Remoting memory leak?

I have a Remoting Class as a Singleton

<configuration>
   <system.runtime.remoting>
      <application>
         <service>
            <wellknown 
               mode="Singleton" 
               type="PTSSLinkClasses.PTSSLinkClientDesktopRemotable, PTSSLinkClasses" 
               objectUri="PTSSLinkDesktop" />
         </service>
         <channels>
            <channel ref="http" port="8901"/>
         </channels>
      </application>
   </system.runtime.remoting>
</configuration>

Its created within a "server" Service. Another client service consumes this remote object. The client is calling the remote object every .5 second using a timer (polling) (for testing)

If the server service is stopped, so the remote object is not available, memory useage for the client service keeps increasing......

I have overwritten InitialLifetimeService to return a null

public override Object InitializeLifetimeService()
        {
            return null;
        }

If a remote object is not available does .net queue all the call requests to this object??? untill all the memory is consumed? How can I dected if the remote object is not available and stop trying to call the remote method?

.NET Remoting doesn´t queue the calls to remote objects. When a remote object is no longer available and you call a method on it, you should receive an Exception (WebException, RemotingException), that the requested service is not found.

I think your problem is somewhere else. Maybe you ignore the possible Exception in your code and doesn´t handle it corretly.

Do you use the same timer again for calling the remote object, or do you create every .5 seconds a new timer to call the remote object?

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