开发者

.NET Remoting memory leak?

开发者 https://www.devze.com 2022-12-27 20:02 出处:网络
I have a Remoting Class as a Singleton <configuration> <system.runtime.remo开发者_StackOverflow社区ting>

I have a Remoting Class as a Singleton

<configuration>
   <system.runtime.remo开发者_StackOverflow社区ting>
      <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?

0

精彩评论

暂无评论...
验证码 换一张
取 消