堆内存的问题内存、问题

2023-09-04 01:12:16 作者:花落未央

还有一个必须工作99%的时间WCF自托管服务。有时候,我们得到了这样一些内存的烦恼:

There's a WCF self hosted service that must work 99% of time. Sometimes we got some memory troubles like this:

但服务正在像往常一样在那之后的问题。我们如何管理呢?任何提示,并指出,使强大的服务,这将在不同的生存,除非情况是非常非常受欢迎的。

But service is working as usual after that issues. How can we manage this? Any tips and points to make robust services that will survive in different except situations are very very welcome.

推荐答案

我也不太清楚是哪里的问题所在,但内存泄漏可能是一个原因。

I am not too sure where the problem resides but memory leaking can be a reason.

所有code管理。而我们使用的dotConnect为Oracle从devArt作为   数据层库。

All code is managed. And we use dotConnect for Oracle from devArt as data layer library.

您承担全部code进行管理,但可以有非托管部分。但是,必须调用Dispose方法对于所有使用后的一次性物品,不要以为他们是妥善处置,一旦他们走出去的范围。最好的做法是,不要让一次性对象超出范围,而不调用其Dispose方法。您可以使用,如果您使用的是他们作为局部变量使用的语句。

You assume all code is managed, but there can be unmanaged parts. However, you must call the Dispose method for all the disposable objects after using them, don't think they are properly dispose once they go out of scope. The best practice is, not to let Disposable objects to go out of scope without calling their Dispose method. You may be able to use 'using' statements if you are using them as local variables.

的DbConnection是一个很好的例子处置的对象,一定要处理所有的连接(一次性物品)。

DbConnection is a good example for disposable objects, make sure you dispose all the connections (disposable objects).

 
精彩推荐
图片推荐