2010-07-28 147 views
5

在我們對我們的ASP.NET應用程序訪問內部Web服務運行壓力測試後,我們的中間層服務器(我們託管ASMX .NET 3.5 Web服務)顯示接近1GB的內存消耗。.NET內存泄漏

從中間層服務器檢查內存轉儲後,我發現Web服務運行時本身引用了Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer的超過1000個對象。

這與我們的自定義對象如何在Web服務層中進行序列化/反序列化有關嗎?任何人都可以在這方面得到更多的啓示!

當我做了一些1000個的對象gcroot,我得到了以下跟蹤: (Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeFileWatcher) - > 1c4bb450(System.Threading.Thread) - > 18236aa0(System.Runtime.Remoting.Contexts.Context) - > 18236914(System.AppDomain) - > 10409dc4(System.ResolveEventHandler) - > 10409494(System.Web.Compilation.BuildManager) - > 10409f30( System.Web.Compilation.MemoryBuildResultCache) - > 103d115c(System.Web.Caching.CacheMultiple) - > 103d1174(System.Object []) - > 103d2034(System.Web.Caching.CacheSingle) - > 103d2080(System.Collections.Hashtable) - > 1c24b97c(System.Collections.Hashtable +桶[]) - > 1c24b934(System.Web.Caching.CacheEntry) - > 18363994(System.Web.Services.Protocols。 SoapServerType) - > 183639c4(System.Collections.Hashtable) - > 1c24aa5c(System.Collections.Hashtable +桶[]) - > 1c24a458(System.Web.Services.Protocols.SoapServerMethod) - > 1c248ae4(微軟。 Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer26)

(Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeFileWatcher) - > 1c5ac4b0(System.Threading.Thread) - > 1c52b5f0(System.Runtime.Remoting.Contexts.Context) - > 1c52b464(System.AppDomain) - > 18823880(System.ResolveEventHandler) - > 18822f50(System.Web.Compilation.BuildManager) - > 188239e0(系統.Web.Compilation.MemoryBuildResultCache) - > 144631fc(System.Web.Caching.CacheMultiple) - > 14463214(System.Object的[]) - > 14465088(System.Web.Caching.CacheSingle) - > 144650d4(系統.Collections.Hashtable) - > 1446510c(System.Collections.Hashtable + bucket []) - > 1c5a580c(System.Web.Caching.CacheEntry) - > 109e6e34(System.Web.Services.Protocols.SoapServerType) - > 109e6e64(System.Collections.Hashtable) - > 1c5a4fcc (System.Collections.Hashtable +桶[]) - > 1c5a4a54(System.Web.Services.Protocols.SoapServerMethod) - > 1c5a44f4(Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer28)

(Microsoft.Practices。 EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeFileWatcher) - > 108b38f0(System.Threading.Thread) - > 1c1155ec(System.Runtime.Remoting.Contexts.Context) - > 1c115460(System.AppDomain) - > 1030d348( System.ResolveEventHandler) - > 1030ca18(System.Web.Compilation.BuildManager) - > 1030d4a0(System.Web.Compilation.MemoryBuildResultCache) - > 102d7ae4(System.Web.Caching.CacheMultiple) - > 102d7afc(System。對象[]) - > 102d7b1c(System.Web.Caching.CacheSingle) - > 102d7b68(System.Collections.Hashtable) - > 102d7bac(System.Collections.Hashtable +桶[]) - > 181ee124(系統。 (System.Collections.Hashtable + bucket []) - > (> System.Web.Caching.CacheEntry) 181ed148(System.Web.Services.Protocols.SoapServerMethod) - > 181eb708(Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer61)

由於 BK

+0

我強烈建議轉移到WCF。 – Andrey 2010-07-28 16:07:03

+0

我很樂意。這是現有的代碼,我們最近更新到ASP.NET 3.5 – 2010-07-28 16:23:47

回答

1

我強烈建議我們簡單地命名爲.Net內存分析器http://memprofiler.com/download.aspx

您可以免費使用完整版14天。

我發現它對解決這類問題很有用。它會顯示參考樹。確定這些類型的問題非常簡單。