调试内存不足异常

时间:2015-07-15 22:23:54

标签: exception nhibernate memory-leaks out-of-memory castle-windsor

我正在调查我在我的应用程序中遇到的内存泄漏问题。 GC堆上有大量的System.String(接近3GB)。在一些调查中,我得到了以下的根参考。 Windsor的问题是不释放组件并跟踪它们吗?

0:000> !gcroot 3dfc30b0
    HandleTable:
        21c512ec (pinned handle)
        -> 136e17d0 System.Object[]
        -> 02c4eacc Azure.Cloud.Util.IoC.IoC
        -> 02c4eac0 Azure.Cloud.Util.IoC.ResolveWindsorContainer
        -> 06bec338 Castle.Windsor.WindsorContainer
        -> 06bec35c Castle.MicroKernel.DefaultKernel
        -> 06bec464 System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[Castle.MicroKernel.ISubSystem, Castle.Windsor]]
        -> 06becb64 System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[Castle.MicroKernel.ISubSystem, Castle.Windsor]][]
        -> 06becbe0 Castle.Windsor.Diagnostics.DefaultDiagnosticsSubSystem
        -> 06becbf8 System.Collections.Generic.List`1[[Castle.Windsor.Diagnostics.IContainerDebuggerExtension, Castle.Windsor]]
        -> 06becdf8 System.Object[]
        -> 06bece5c Castle.Windsor.Diagnostics.Extensions.ReleasePolicyTrackedObjects
        -> 06bece68 Castle.Windsor.Diagnostics.TrackedComponentsDiagnostic
        -> 06becf4c System.EventHandler`1[[Castle.Windsor.Diagnostics.TrackedInstancesEventArgs, Castle.Windsor]]
        -> 06bece9c Castle.MicroKernel.Releasers.LifecycledComponentsReleasePolicy
        -> 06beceb4 System.Collections.Generic.Dictionary`2[[System.Object, mscorlib],[Castle.MicroKernel.Burden, Castle.Windsor]]
        -> d6463f60 System.Collections.Generic.Dictionary`2+Entry[[System.Object, mscorlib],[Castle.MicroKernel.Burden, Castle.Windsor]][]
        -> 83727088 NHibernate.Impl.SessionImpl
        -> 837273b4 NHibernate.Engine.StatefulPersistenceContext
        -> 83727408 System.Collections.Generic.Dictionary`2[[NHibernate.Engine.EntityKey, NHibernate],[System.Object, mscorlib]]
        -> 83727470 System.Collections.Generic.Dictionary`2+Entry[[NHibernate.Engine.EntityKey, NHibernate],[System.Object, mscorlib]][]
        -> 837282ec Azure.Cloud.Domain.Lists.ItemList
        -> 83728778 NHibernate.Collection.Generic.PersistentGenericBag`1[[Azure.Cloud.Domain.Lists.ItemListDetail, Azure.Cloud.Domain]]
        -> 8372c1b4 System.Collections.Generic.List`1[[System.Object, mscorlib]]
        -> 8372c1cc System.Object[]
        -> 8372bff4 Azure.Cloud.Domain.Lists.ItemListDetail
        -> 3dfc30b0 System.String

1 个答案:

答案 0 :(得分:4)

记得告诉温莎release the objects。如文章所述,这可以通过多种方式完成。