我构建的 MVC 3 应用程序中存在内存泄漏。我已经使用 DebugDiag 来获取一些调试信息,但很难理解结果。结果指向 clr!EEHeapAlloc+cb,每次刷新页面时,它的内存使用量都会不断上升。任何帮助将不胜感激。结果如下:
功能详情
Function clr!EEHeapAlloc+cb
Allocation type Heap allocation(s)
Allocation Count 1507120 allocation(s)
Allocation Size 1.13 GBytes
Leak Probability 79%
调用堆栈示例 1
Address 0x214734a0
Allocation Time 00:05:02 since tracking started
Allocation Size 64 Bytes
函数源目标
clr!EEHeapAlloc+cb ntdll!RtlAllocateHeap
clr!EEHeapAllocInProcessHeap+5c clr!EEHeapAlloc
clr!operator new+2b clr!EEHeapAllocInProcessHeap
clr!CPropertyArray::Set+48 clr!operator new
clr!CAssemblyName::SetProperty+109 clr!CPropertyArray::Set
clr!FusionBind::CreateFusionName+2ee
clr!FusionBind::LoadAssembly+9c clr!FusionBind::CreateFusionName
clr!AssemblySpec::FindAssemblyFile+f4
clr!AppDomain::BindAssemblySpec+2f2 clr!AssemblySpec::FindAssemblyFile
clr!AssemblySpec::LoadDomainAssembly+2bc
clr!AssemblySpec::LoadAssembly+19 clr!AssemblySpec::LoadDomainAssembly
clr!AssemblyNative::Load+297
System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo, Boolean, Boolean, System.Threading.StackCrawlMark ByRef) 0x1E7B66
System.Resources.ResourceManager.GetString(System.String, System.Globalization.CultureInfo)
System.Environment+ResourceHelper.GetResourceStringCode(System.Object)
clr!CallDescrWorker+33
clr!CallDescrWorkerWithHandler+8e clr!CallDescrWorker
clr!MethodDesc::CallDescr+194 clr!CallDescrWorkerWithHandler
clr!MethodDesc::CallTargetWorker+21 clr!MethodDesc::CallDescr
clr!MethodDescCallSite::Call+1c clr!MethodDesc::CallTargetWorker
clr!ExecuteCodeWithGuaranteedCleanupHelper+bb
clr!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup+138 clr!ExecuteCodeWithGuaranteedCleanupHelper
clr!CallDescrWorker+33
clr!CallDescrWorkerWithHandler+8e clr!CallDescrWorker
clr!MethodDesc::CallDescr+194 clr!CallDescrWorkerWithHandler
clr!MethodDesc::CallTargetWorker+21 clr!MethodDesc::CallDescr
clr!GetResourceStringFromManaged+198
clr!GetResourceFromDefault+e2 clr!GetResourceStringFromManaged
clr!CallDescrWorker+33
clr!RuntimeTypeHandle::CreateInstance+61e
clr! ?? ::FNODOBFM::`string'+42e78
System.Collections.Generic.HashSet`1[[System.__Canon, mscorlib]].UnionWith(System.Collections.Generic.IEnumerable`1<System.__Canon>) 0x1EB0BA
Glimpse.Mvc3.Plumbing.GlimpseDependencyResolver.GetService(System.Type) 0x86A4B2
System_Core_ni+1cbb28
System.Web.Mvc.ControllerTypeCache.GetControllerTypes(System.String, System.Collections.Generic.HashSet`1<System.String>)
System.Collections.Generic.HashSet`1[[System.__Canon, mscorlib]].System.Collections.Generic.IEnumerable<T>.GetEnumerator()
System_Core_ni+1d0f28
System_Web_Mvc_ni+110c18
System.Web.Mvc.DefaultControllerFactory.CreateController(System.Web.Routing.RequestContext, System.String)
Castle.Proxies.Invocations.DefaultControllerFactory_CreateController.InvokeMethodOnTarget()
clr! ?? ::FNODOBFM::`string'+65d52
Castle.DynamicProxy.AbstractInvocation.Proceed()
Castle.Proxies.DefaultControllerFactoryProxy.CreateController(System.Web.Routing.RequestContext, System.String) Castle.DynamicProxy.AbstractInvocation.Proceed()
System.Collections.Hashtable.InitHash(System.Object, Int32, UInt32 ByRef, UInt32 ByRef)
System.Web.SiteMapNode.IsAccessibleToUser(System.Web.HttpContext)
System.Web.StaticSiteMapProvider.GetChildNodes(System.Web.SiteMapNode)
System.Web.SiteMapNode.get_ChildNodes()
System.Web.SiteMapNode.get_HasChildNodes()
MvcSiteMapProvider.Web.Html.MenuHelper.BuildModel(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean)
MvcSiteMapProvider.Web.Html.MenuHelper.BuildModel(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean) MvcSiteMapProvider.Web.Html.MenuHelper.BuildModel(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean)
MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.String, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean) MvcSiteMapProvider.Web.Html.MenuHelper.BuildModel(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean)
MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean) MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.String, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean)
MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, Boolean, Boolean, Boolean) MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, System.Web.SiteMapNode, Boolean, Boolean, Int32, Boolean)
ASP._Page_Views_Shared__SubMenu_cshtml.Execute() MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapProvider.Web.Html.MvcSiteMapHtmlHelper, Boolean, Boolean, Boolean)
System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
0xB373A48
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext, System.IO.TextWriter, System.Web.WebPages.WebPageRenderingBase)
System.Web.Mvc.BuildManagerCompiledView.Render(System.Web.Mvc.ViewContext, System.IO.TextWriter)
System.Web.Mvc.Html.PartialExtensions.Partial(System.Web.Mvc.HtmlHelper, System.String, System.Object, System.Web.Mvc.ViewDataDictionary)
ASP._Page_Views_Shared__Layout_cshtml.Execute()
System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
0xB3738BC
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext, System.IO.TextWriter, System.Web.WebPages.WebPageRenderingBase)
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext, System.IO.TextWriter) System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext, System.IO.TextWriter, System.Web.WebPages.WebPageRenderingBase)
System.Web.WebPages.WebPageBase+<>c__DisplayClass7.<RenderPageCore>b__6(System.IO.TextWriter) System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext, System.IO.TextWriter)
System.Web.WebPages.HelperResult.WriteTo(System.IO.TextWriter)
System.Web.WebPages.WebPageExecutingBase.WriteTo(System.IO.TextWriter, System.Web.WebPages.HelperResult) System.Web.WebPages.HelperResult.WriteTo(System.IO.TextWriter)
System.Web.WebPages.WebPageBase.Write(System.Web.WebPages.HelperResult) System.Web.WebPages.WebPageExecutingBase.WriteTo(System.IO.TextWriter, System.Web.WebPages.HelperResult)
System.Web.WebPages.WebPageBase.RenderSurrounding(System.String, System.Action`1<System.IO.TextWriter>)
System.Web.WebPages.WebPageBase.PopContext() System.Web.WebPages.WebPageBase.RenderSurrounding(System.String, System.Action`1)
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext, System.IO.TextWriter, System.Web.WebPages.WebPageRenderingBase) System.Web.WebPages.WebPageBase.PopContext()
System.Web.Mvc.BuildManagerCompiledView.Render(System.Web.Mvc.ViewContext, System.IO.TextWriter)
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(System.Web.Mvc.ControllerContext, System.Web.Mvc.ActionResult)
Castle.Proxies.ControllerActionInvokerProxy.InvokeActionResult_callback(System.Web.Mvc.ControllerContext, System.Web.Mvc.ActionResult) System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(System.Web.Mvc.ControllerContext, System.Web.Mvc.ActionResult)
Castle.Proxies.Invocations.ControllerActionInvoker_InvokeActionResult.InvokeMethodOnTarget()
Castle.DynamicProxy.AbstractInvocation.Proceed()
Castle.Proxies.ControllerActionInvokerProxy.InvokeActionResult(System.Web.Mvc.ControllerContext, System.Web.Mvc.ActionResult) Castle.DynamicProxy.AbstractInvocation.Proceed()
System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(System.Web.Mvc.IResultFilter, System.Web.Mvc.ResultExecutingContext, System.Func`1<System.Web.Mvc.ResultExecutedContext>)
System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1c+<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(System.Web.Mvc.IResultFilter, System.Web.Mvc.ResultExecutingContext, System.Func`1)
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(System.Web.Mvc.ControllerContext, System.Collections.Generic.IList`1<System.Web.Mvc.IResultFilter>, System.Web.Mvc.ActionResult)
System.Web.Mvc.ControllerActionInvoker.InvokeAction(System.Web.Mvc.ControllerContext, System.String)
System.Web.Mvc.ControllerBase.Execute(System.Web.Routing.RequestContext)
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(System.Web.Routing.RequestContext)
System.Web.Mvc.Async.AsyncResultWrapper+<>c__DisplayClass1.<MakeVoidDelegate>b__0()
System.Web.Mvc.Async.AsyncResultWrapper+<>c__DisplayClass8`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc]].<BeginSynchronous>b__7(System.IAsyncResult)
System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[[System.Web.Mvc.Async.AsyncVoid, System.Web.Mvc]].End()
System_Web_Mvc_ni+49938
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(System.Action)
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(System.Action)
System.Web.Mvc.MvcHandler.EndProcessRequest(System.IAsyncResult) System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(System.Action)
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult)
System.Web.HttpApplication.ResumeStepsFromThreadPoolThread(System.Exception)
System.Web.HttpApplication+AsyncEventExecutionStep.OnAsyncEventCompletion(System.IAsyncResult) System.Web.HttpApplication.ResumeStepsFromThreadPoolThread(System.Exception)
System.Web.HttpAsyncResult.Complete(Boolean, System.Object, System.Exception, System.Web.RequestNotificationStatus)
System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(System.Object) System.Web.HttpAsyncResult.Complete(Boolean, System.Object, System.Exception, System.Web.RequestNotificationStatus)
0x8CFA453
System.Threading._TimerCallback.TimerCallback_Context(System.Object)
System.Threading.ExecutionContext.runTryCode(System.Object)
clr!CallDescrWorker+33
clr!CallDescrWorkerWithHandler+8e clr!CallDescrWorker
clr!MethodDesc::CallDescr+194 clr!CallDescrWorkerWithHandler
clr!MethodDesc::CallTargetWorker+21 clr!MethodDesc::CallDescr
clr!MethodDescCallSite::Call+1c clr!MethodDesc::CallTargetWorker
clr!ExecuteCodeWithGuaranteedCleanupHelper+bb
clr!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup+138 clr!ExecuteCodeWithGuaranteedCleanupHelper
clr!CallDescrWorker+33
clr!CallDescrWorkerWithHandler+8e clr!CallDescrWorker
clr!DispatchCallBody+20 clr!CallDescrWorkerWithHandler
clr!DispatchCallDebuggerWrapper+75 clr!DispatchCallBody
clr!DispatchCallNoEH+53 clr!DispatchCallDebuggerWrapper
clr!AddTimerCallback_Worker+70 clr!DispatchCallNoEH
clr!Thread::DoExtraWorkForFinalizer+114
clr! ?? ::FNODOBFM::`string'+36051
clr!DebuggerU2MCatchHandlerFrame::`vftable'
clr!_except_handler4
clr! ?? ::FNODOBFM::`string'+366e2
clr!Thread::RaiseCrossContextException+3e1
0x1089228
clr!`string'+3c
clr!`string'+3c
clr! ?? ::FNODOBFM::`string'+36051
clr!DebuggerU2MCatchHandlerFrame::`vftable'
clr!_except_handler4
clr! ?? ::FNODOBFM::`string'+29219
clr!ThreadpoolMgr::AsyncTimerCallbackCompletion+83
clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+195
clr!ThreadpoolMgr::WorkerThreadStart
clr!SlowClrFlsSetValue+42
clr! ?? ::FNODOBFM::`string'+41b4f
clr!ThreadpoolMgr::WorkerThreadStart
clr!ThreadpoolMgr::WorkerThreadStart
clr!operator delete+41
clr!ThreadpoolMgr::WorkerThreadStart
clr! ?? ::FNODOBFM::`string'+41bd8
clr!Thread::intermediateThreadProc+4b
kernel32!BaseThreadInitThunk+e
ntdll!__RtlUserThreadStart+70
ntdll!_RtlUserThreadStart+1b ntdll!__RtlUserThreadStart
clr!Thread::intermediateThreadProc