简体   繁体   English

.NET远程内存泄漏?

[英].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) 客户端使用计时器(轮询)每0.5秒调用一次远程对象(用于测试)

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 我已覆盖InitialLifetimeService以返回null

public override Object InitializeLifetimeService()
        {
            return null;
        }

If a remote object is not available does .net queue all the call requests to this object??? 如果远程对象不可用,.net会将对该对象的所有呼叫请求排队吗??? 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. .NET Remoting不会将对远程对象的调用排队。 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. 当远程对象不再可用并在其上调用方法时,应该收到一个异常(WebException,RemotingException),该异常找不到所请求的服务。

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.5秒创建一个新计时器来调用远程对象?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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