还有没有已知的内存泄漏与XMLSerialization在.NET 3.5中?内存、XMLSerialization、NET

2023-09-04 02:44:18 作者:淡笑看过尘世。

此文章http://blogs.msdn.com/tess/archive/2006/02/15/532804.aspx通过苔丝Ferrandez为什么使用XMLSerialization可能导致内存泄漏的轮廓。

This article http://blogs.msdn.com/tess/archive/2006/02/15/532804.aspx by Tess Ferrandez outlines why using XMLSerialization can cause memory leaks.

泄漏是如何的对象实例化内存集,而不是对象,因此不会被垃圾收集器目标的结果。

The leak is a result of how the objects are instantiated in memory as assemblies, not objects so are not targeted by the Garbage Collector.

这篇文章最初是写在1.0 / 1.1 CLR,但更新是不清楚的2.0 CLR。​​

The article was originally written on the 1.0/1.1 CLR, but the updates are unclear about the 2.0 CLR.

我在Web应用程序中使用XMLSerialization /反序列化广泛仍处于测试阶段的UI /服务器交流。的对象仅仅是DTO的(只有属性的对象)。

I'm using XMLSerialization/Deserialization extensively in a web app still in beta for UI/server exchanges. The objects are just DTOs (objects with only properties).

感谢你在前进!

推荐答案

它主要是通过.NET 2.0 DynamicMethod的解决。然而,仍然有故障模式,如果你不使用[XmlRoot]属性。回顾这篇文章了解详细信息。

It is largely solved through the .NET 2.0 DynamicMethod. However, there's still a failure mode if you don't use the [XmlRoot] attribute. Review this article for details.