<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx</link><description>I hate to give away the resolution in the title of the blog since it takes away a lot of the suspense:) but I can't figure out a better way to name the blog posts and still keep them nicely searcheable so here we go... This one has come up a number of</description><dc:language>sv-SE</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#532827</link><pubDate>Thu, 16 Feb 2006 01:56:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:532827</guid><dc:creator>tzagotta</dc:creator><description>Is this issue the same or different in .NET 2.0?</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#532835</link><pubDate>Thu, 16 Feb 2006 02:11:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:532835</guid><dc:creator>Don</dc:creator><description>Wow. &amp;nbsp;Really frightening. &amp;nbsp;I'm checking my code right now. &amp;nbsp;Thanks.</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533081</link><pubDate>Thu, 16 Feb 2006 11:52:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533081</guid><dc:creator>Tess</dc:creator><description>I dont believe that this has changed in .NET 2.0, tracking assemblies with the gc and unloading them at garbage collection is a pretty large task given the implications it would have. &amp;nbsp; </description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533092</link><pubDate>Thu, 16 Feb 2006 12:30:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533092</guid><dc:creator>john_grace</dc:creator><description>I believe the new way to do this type of work in .NET 2.0 is to use the SGEN utility to generate the necessary classes. &lt;br&gt;Then bring these classes into your solution so there is no need to generate a dynamic assembly.</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533103</link><pubDate>Thu, 16 Feb 2006 12:49:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533103</guid><dc:creator>Tess</dc:creator><description>Nice info about SGEN, definitely worth looking into</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533108</link><pubDate>Thu, 16 Feb 2006 12:52:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533108</guid><dc:creator>Matt</dc:creator><description>So why doesn' t the documentation for the class explain this?</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533124</link><pubDate>Thu, 16 Feb 2006 13:09:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533124</guid><dc:creator>Tess</dc:creator><description>My guess is that it is because it is close to impossible to document everything, and this is an internal implementation detail. &amp;nbsp;When it was developed I don't believe that it was intended to be used this way (since we are talking about special cases in the constructor). &amp;nbsp;This is why we create kb articles when we discover issues, and of course also why i blog about them:) &lt;br&gt;&lt;br&gt;If you feel that it should be added to the original msdn content (which i think is a great idea) I would urge you to use the comment feature on the msdn topic so that the content developers can change it. &amp;nbsp;</description></item><item><title>Interesting Finds</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533151</link><pubDate>Thu, 16 Feb 2006 14:16:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533151</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>Interesting Finds</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533157</link><pubDate>Thu, 16 Feb 2006 14:18:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533157</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#533158</link><pubDate>Thu, 16 Feb 2006 14:19:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533158</guid><dc:creator>Matt</dc:creator><description>Oh, I see it is documented in the 'about xmlserializer' topic.&lt;br&gt;&lt;br&gt;(Incidentally, we were burned by the xsl transform script variant of this issue)</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#534253</link><pubDate>Fri, 17 Feb 2006 21:29:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:534253</guid><dc:creator>Kerry Jenkins</dc:creator><description>Thank you for the great content you are sharing!</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#534276</link><pubDate>Fri, 17 Feb 2006 22:03:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:534276</guid><dc:creator>Mark Wan</dc:creator><description>Very useful information. &amp;nbsp;Thanks for writing this blog.&lt;br&gt;&lt;br&gt;I suppose this is the same problem in BinarySerializer as well?&lt;br&gt;</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#534517</link><pubDate>Sat, 18 Feb 2006 03:41:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:534517</guid><dc:creator>Keith Hill</dc:creator><description>Awesome! &amp;nbsp;Keep it coming.</description></item><item><title>How to create giant memory leaks with XmlSerializer</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#534924</link><pubDate>Sun, 19 Feb 2006 07:11:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:534924</guid><dc:creator>Dan Crevier's Blog</dc:creator><description>In this post, Tess describes how using repeatedly calling:&lt;br&gt;XmlSerializer serializer = new XmlSerializer(typeof(PurchaseOrder),...</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#541469</link><pubDate>Wed, 01 Mar 2006 22:37:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:541469</guid><dc:creator>Eric Terrell</dc:creator><description>Very useful article. Can you tell me which forms of the Regex constructor cause this issue? Or does it just happen if you specify the &amp;quot;compiled&amp;quot; flavor of Regex?</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#549513</link><pubDate>Sat, 11 Mar 2006 20:36:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:549513</guid><dc:creator>dblack</dc:creator><description>I've found your posts about Memory debugging in .NET EXTREMELY useful! &amp;nbsp;Thank you and keep posting away!</description></item><item><title>.NET Resources</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#591373</link><pubDate>Sat, 06 May 2006 11:30:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:591373</guid><dc:creator>mattonsoftware.com</dc:creator><description>The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;amp;amp;nbsp;...</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#754595</link><pubDate>Thu, 14 Sep 2006 22:50:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:754595</guid><dc:creator>jeremyp</dc:creator><description>Awesome post, as usual! :)&lt;br&gt;&lt;br&gt;One more trick that can help is to use -MT on the dumpmodule, like !dumpmodule -MT &amp;lt;da_addr&amp;gt; and look at the referenced types for that assembly. This can sometimes be easier to view than the dc output... ;)</description></item><item><title>XmlSerializer : lenteur de la première initialisation et comment y remedier</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#1754641</link><pubDate>Sun, 25 Feb 2007 02:35:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1754641</guid><dc:creator>CoqBlog</dc:creator><description>&lt;p&gt;A la premi&amp;#232;re&amp;#160;initialisation d'une instance de XmlSerializer pour un type,&amp;#160;le constructeur d&amp;#233;clenche&lt;/p&gt;
</description></item><item><title>Ännu ett projekt som XMLSeriliserar sig in i minnesläckor...</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#1936929</link><pubDate>Fri, 23 Mar 2007 14:38:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1936929</guid><dc:creator>Shallow thoughts from a consultant @ Microsoft</dc:creator><description>&lt;p&gt;Ig&amp;#229;r var jag inne och debuggade en dump fr&amp;#229;n ett projekt d&amp;#228;r man hade problem med en w3wp process som&lt;/p&gt;
</description></item><item><title>Ännu ett projekt som XMLSerialiserar sig till Out-Of-Memory...</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#1937083</link><pubDate>Fri, 23 Mar 2007 15:33:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1937083</guid><dc:creator>RSS It All</dc:creator><description>&lt;p&gt;Ig&amp;#229;r var jag inne och debuggade en dump fr&amp;#229;n ett projekt d&amp;#228;r man hade problem med en w3wp process som&lt;/p&gt;
</description></item><item><title>All in a days work&amp;#8230;</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#2123693</link><pubDate>Sat, 14 Apr 2007 04:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2123693</guid><dc:creator>All in a days work…</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://billy-girlardo.com/delicious/2007/04/13/links-for-2007-04-14/"&gt;http://billy-girlardo.com/delicious/2007/04/13/links-for-2007-04-14/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>  .NET Garbage Collector PopQuiz - Followup at  Sanal Kiler</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#2146791</link><pubDate>Sun, 15 Apr 2007 23:07:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2146791</guid><dc:creator>  .NET Garbage Collector PopQuiz - Followup at  Sanal Kiler</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://sanal.org/?p=309"&gt;http://sanal.org/?p=309&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#2170936</link><pubDate>Wed, 18 Apr 2007 11:04:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2170936</guid><dc:creator>Simon Gibbs</dc:creator><description>&lt;p&gt;I would also be grateful for any additional detail on the Regex flavour of the problem.&lt;/p&gt;</description></item><item><title>.NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#2188935</link><pubDate>Thu, 19 Apr 2007 11:57:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2188935</guid><dc:creator>n.code</dc:creator><description>&lt;p&gt;Tess Ferrandez talks about a .NET memory leak , caused by using the default constructors other than,&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#2193400</link><pubDate>Thu, 19 Apr 2007 18:40:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2193400</guid><dc:creator>ScrawnyBrawn</dc:creator><description>&lt;p&gt;Nice article. &amp;nbsp;It 'brings back good memories' of using adplus! &lt;/p&gt;
&lt;p&gt;I have not gone through rest of your blog.. but I would say.. the title needs to be changed... &lt;/p&gt;
&lt;p&gt;If broken it is, fix it you 'must' ... that sounds more yoda-ish :)&lt;/p&gt;
</description></item><item><title>.NET Garbage Collector PopQuiz - Followup</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#2458674</link><pubDate>Mon, 07 May 2007 09:19:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2458674</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;It was really exciting to see that so many people answered the .NET GC PopQuiz , especially seeing that&lt;/p&gt;
</description></item><item><title>top 10 windbg.exe usage articles</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#3504704</link><pubDate>Mon, 25 Jun 2007 00:10:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3504704</guid><dc:creator>roy ashbrook</dc:creator><description>&lt;p&gt;These are the articles (in no particular order) that I felt best showed a thorough use of the windbg&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#3600861</link><pubDate>Fri, 29 Jun 2007 12:48:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3600861</guid><dc:creator>Niels Tindbæk</dc:creator><description>&lt;p&gt;Great article!&lt;/p&gt;
&lt;p&gt;We do a lot of webservice calls, and we have the same issues. Mostly shown as OutOfMem exceptions in the internal code of the XmlSerializer.Deserialize.&lt;/p&gt;
&lt;p&gt;But since it is called by the framework code of the webservice classes, I cant really do any caching.&lt;/p&gt;
&lt;p&gt;Do you have a suggestion for our situation?&lt;/p&gt;</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#3601181</link><pubDate>Fri, 29 Jun 2007 13:37:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3601181</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi Nils,&lt;/p&gt;
&lt;p&gt;I am not sure that you are looking at the same thing here as what is described in the article.&lt;/p&gt;
&lt;p&gt;The article is about leaking dynamic assemblies when creating new xmlserializers, &amp;nbsp;in the case of webservices you will only have one xmlserializer per type you are serializing so that should not amount to too many.&lt;/p&gt;
&lt;p&gt;If you are seeing OOMs when you deserialize i see two reasons why this could happen&lt;/p&gt;
&lt;p&gt;1. If each deserialization is only generating a small string/object your problem is that you have high overall memory consumption and you should investigate what is using up all the memory...&lt;/p&gt;
&lt;p&gt;or &lt;/p&gt;
&lt;p&gt;2. more likely, if it seems to happen frequently in Deserialize, you are sending a lot of data back and forth so that the data sent over or the deserialized data is huge and requires a new large object heap block that wont fit anywhere.&lt;/p&gt;
&lt;p&gt;I would recommend that you run with GCFailFastOnOOM to see how much it is trying to allocate when it fails to see if this is some really big chunk, unless you fit into #1 where your memory consumption overall is big.&lt;/p&gt;
&lt;p&gt;There are a couple of post on this blog on how to troubleshoot high memory issues that you might want to look into as well.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>关于.net内存泄露的问题，请高手指点</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#3741454</link><pubDate>Sat, 07 Jul 2007 09:28:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3741454</guid><dc:creator>Tiny</dc:creator><description>&lt;p&gt;一个.net开发的网站项目现在到了收尾阶段，但突然发现一个问题：网站访问量不高，占用内存却长地飞快，甚至2，3个小时内存使用就上涨到了1g多，非常郁闷。google了一下，查到了几篇相关文章。无法卸...&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#3783133</link><pubDate>Mon, 09 Jul 2007 19:15:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3783133</guid><dc:creator>chen</dc:creator><description>&lt;p&gt;Hi Tess,&lt;/p&gt;
&lt;p&gt;I'm debugging a slightly different beast that happens only on certain m/cs in our environment. First a quick background on the environments: &lt;/p&gt;
&lt;p&gt; - all m/cs are running on Windows Server 2003, SP1 (Std Edition) IIS 6.0&lt;/p&gt;
&lt;p&gt;- 4 GB memory&lt;/p&gt;
&lt;p&gt;- Both .NET 1.1 &amp;amp; 2.0 installed &lt;/p&gt;
&lt;p&gt;- number of hotfixes applied&lt;/p&gt;
&lt;p&gt;Initial investigation lead me to believe that a possible memory leak in &amp;quot;private bytes&amp;quot; was specific to our web service implementation. So we eventually stubbed out all app specific code &amp;amp; still saw the private bytes increase steadily until the worker process recycled because it reached the &amp;quot;Maximum used memory&amp;quot; limit for the App Pool config.&lt;/p&gt;
&lt;p&gt;To confirm the theory that app related stuff wasn't the culprit, i then created a basic &amp;quot;HelloWorld&amp;quot; web service &amp;amp; set the app pool settings to recycle the worker process when the &amp;quot;Maximum used memory&amp;quot; reached 50MB. Ran the test... private bytes increased steadily and eventually the worker process recycled.&lt;/p&gt;
&lt;p&gt;I re-ran this same test on a different m/c (same OS level, 2GB memory but a slightly different set of hotfixes applied to it). Here the HelloWorld app does NOT exhibit the leak (which is what i was expecting).&lt;/p&gt;
&lt;p&gt;I've tried analysing by gathering minidumps, VA dumps, perf logs - the only thing that stands out between the leaking/non-leaking servers is the Heap size.&lt;/p&gt;
&lt;p&gt;Here are some excerpts from the VADump for the leaking case (dumps were taken roughly 45secs apart):&lt;/p&gt;
&lt;p&gt;Category &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Private Shareable &amp;nbsp; &amp;nbsp;Shared&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pages &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Page Table Pages &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;84 &amp;nbsp; &amp;nbsp; &amp;nbsp; 336 &amp;nbsp; &amp;nbsp; &amp;nbsp; 336 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Other System &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;39 &amp;nbsp; &amp;nbsp; &amp;nbsp; 156 &amp;nbsp; &amp;nbsp; &amp;nbsp; 156 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Code/StaticData &amp;nbsp; &amp;nbsp; &amp;nbsp; 3782 &amp;nbsp; &amp;nbsp; 15128 &amp;nbsp; &amp;nbsp; &amp;nbsp;1312 &amp;nbsp; &amp;nbsp; &amp;nbsp;2736 &amp;nbsp; &amp;nbsp; 11080&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Heap &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 14184 &amp;nbsp; &amp;nbsp; 56736 &amp;nbsp; &amp;nbsp; 56736 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Stack &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 79 &amp;nbsp; &amp;nbsp; &amp;nbsp; 316 &amp;nbsp; &amp;nbsp; &amp;nbsp; 316 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Teb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33 &amp;nbsp; &amp;nbsp; &amp;nbsp; 132 &amp;nbsp; &amp;nbsp; &amp;nbsp; 132 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Mapped Data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;165 &amp;nbsp; &amp;nbsp; &amp;nbsp; 660 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; 556&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Other Data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3179 &amp;nbsp; &amp;nbsp; 12716 &amp;nbsp; &amp;nbsp; 12712 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total Modules &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3782 &amp;nbsp; &amp;nbsp; 15128 &amp;nbsp; &amp;nbsp; &amp;nbsp;1312 &amp;nbsp; &amp;nbsp; &amp;nbsp;2736 &amp;nbsp; &amp;nbsp; 11080&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total Dynamic Data &amp;nbsp; 17640 &amp;nbsp; &amp;nbsp; 70560 &amp;nbsp; &amp;nbsp; 69896 &amp;nbsp; &amp;nbsp; &amp;nbsp; 108 &amp;nbsp; &amp;nbsp; &amp;nbsp; 556&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total System &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 123 &amp;nbsp; &amp;nbsp; &amp;nbsp; 492 &amp;nbsp; &amp;nbsp; &amp;nbsp; 492 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt;Grand Total Working Set &amp;nbsp; &amp;nbsp;21545 &amp;nbsp; &amp;nbsp; 86180 &amp;nbsp; &amp;nbsp; 71700 &amp;nbsp; &amp;nbsp; &amp;nbsp;2844 &amp;nbsp; &amp;nbsp; 11636&lt;/p&gt;
&lt;p&gt;Category &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Private Shareable &amp;nbsp; &amp;nbsp;Shared&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pages &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Page Table Pages &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;97 &amp;nbsp; &amp;nbsp; &amp;nbsp; 388 &amp;nbsp; &amp;nbsp; &amp;nbsp; 388 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Other System &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;51 &amp;nbsp; &amp;nbsp; &amp;nbsp; 204 &amp;nbsp; &amp;nbsp; &amp;nbsp; 204 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Code/StaticData &amp;nbsp; &amp;nbsp; &amp;nbsp; 3790 &amp;nbsp; &amp;nbsp; 15160 &amp;nbsp; &amp;nbsp; &amp;nbsp;1312 &amp;nbsp; &amp;nbsp; &amp;nbsp;2756 &amp;nbsp; &amp;nbsp; 11092&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Heap &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 30298 &amp;nbsp; &amp;nbsp;121192 &amp;nbsp; &amp;nbsp;121192 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Stack &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 79 &amp;nbsp; &amp;nbsp; &amp;nbsp; 316 &amp;nbsp; &amp;nbsp; &amp;nbsp; 316 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Teb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33 &amp;nbsp; &amp;nbsp; &amp;nbsp; 132 &amp;nbsp; &amp;nbsp; &amp;nbsp; 132 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Mapped Data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;165 &amp;nbsp; &amp;nbsp; &amp;nbsp; 660 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; 556&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Other Data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3179 &amp;nbsp; &amp;nbsp; 12716 &amp;nbsp; &amp;nbsp; 12712 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total Modules &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3790 &amp;nbsp; &amp;nbsp; 15160 &amp;nbsp; &amp;nbsp; &amp;nbsp;1312 &amp;nbsp; &amp;nbsp; &amp;nbsp;2756 &amp;nbsp; &amp;nbsp; 11092&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total Dynamic Data &amp;nbsp; 33754 &amp;nbsp; &amp;nbsp;135016 &amp;nbsp; &amp;nbsp;134352 &amp;nbsp; &amp;nbsp; &amp;nbsp; 108 &amp;nbsp; &amp;nbsp; &amp;nbsp; 556&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total System &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 148 &amp;nbsp; &amp;nbsp; &amp;nbsp; 592 &amp;nbsp; &amp;nbsp; &amp;nbsp; 592 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt;Grand Total Working Set &amp;nbsp; &amp;nbsp;37692 &amp;nbsp; &amp;nbsp;150768 &amp;nbsp; &amp;nbsp;136256 &amp;nbsp; &amp;nbsp; &amp;nbsp;2864 &amp;nbsp; &amp;nbsp; 11648&lt;/p&gt;
&lt;p&gt;Category &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Private Shareable &amp;nbsp; &amp;nbsp;Shared&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pages &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes &amp;nbsp; &amp;nbsp;KBytes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Page Table Pages &amp;nbsp; &amp;nbsp; &amp;nbsp; 106 &amp;nbsp; &amp;nbsp; &amp;nbsp; 424 &amp;nbsp; &amp;nbsp; &amp;nbsp; 424 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Other System &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;60 &amp;nbsp; &amp;nbsp; &amp;nbsp; 240 &amp;nbsp; &amp;nbsp; &amp;nbsp; 240 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Code/StaticData &amp;nbsp; &amp;nbsp; &amp;nbsp; 3792 &amp;nbsp; &amp;nbsp; 15168 &amp;nbsp; &amp;nbsp; &amp;nbsp;1312 &amp;nbsp; &amp;nbsp; &amp;nbsp;2756 &amp;nbsp; &amp;nbsp; 11100&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Heap &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 39342 &amp;nbsp; &amp;nbsp;157368 &amp;nbsp; &amp;nbsp;157368 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Stack &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 80 &amp;nbsp; &amp;nbsp; &amp;nbsp; 320 &amp;nbsp; &amp;nbsp; &amp;nbsp; 320 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Teb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 34 &amp;nbsp; &amp;nbsp; &amp;nbsp; 136 &amp;nbsp; &amp;nbsp; &amp;nbsp; 136 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Mapped Data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;165 &amp;nbsp; &amp;nbsp; &amp;nbsp; 660 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; 556&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Other Data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3182 &amp;nbsp; &amp;nbsp; 12728 &amp;nbsp; &amp;nbsp; 12724 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total Modules &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3792 &amp;nbsp; &amp;nbsp; 15168 &amp;nbsp; &amp;nbsp; &amp;nbsp;1312 &amp;nbsp; &amp;nbsp; &amp;nbsp;2756 &amp;nbsp; &amp;nbsp; 11100&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total Dynamic Data &amp;nbsp; 42803 &amp;nbsp; &amp;nbsp;171212 &amp;nbsp; &amp;nbsp;170548 &amp;nbsp; &amp;nbsp; &amp;nbsp; 108 &amp;nbsp; &amp;nbsp; &amp;nbsp; 556&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Total System &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 166 &amp;nbsp; &amp;nbsp; &amp;nbsp; 664 &amp;nbsp; &amp;nbsp; &amp;nbsp; 664 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/p&gt;
&lt;p&gt;Grand Total Working Set &amp;nbsp; &amp;nbsp;46761 &amp;nbsp; &amp;nbsp;187044 &amp;nbsp; &amp;nbsp;172524 &amp;nbsp; &amp;nbsp; &amp;nbsp;2864 &amp;nbsp; &amp;nbsp; 11656&lt;/p&gt;
&lt;p&gt;The Heap pages show the increase while the GC Heap (Other Data) does not show any increase at all (this is what I see in the PerfMon logs as well). What/why is there a dramatic increase in the heap allocations (especially, private bytes)?&lt;/p&gt;
&lt;p&gt;The other thing I see in the mini dumps is that the number of System.String objects &amp;amp; size is seemingly high in the m/c where the leak is happening whereas those values are much lower on the server where it isn’t leaking.&lt;/p&gt;
&lt;p&gt;Can you shed some light on what else should I be looking at? Our production web servers are exhibiting this behavior and we've been unable to figure out why. Please help! &lt;/p&gt;
&lt;p&gt;Thanks. &lt;/p&gt;
&lt;p&gt;PS: btw, i've learned a lot from reading thru your blogs &amp;amp; without them, i wouldn't have gotten the faintest clue on what to look for. &lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#3784676</link><pubDate>Mon, 09 Jul 2007 22:01:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3784676</guid><dc:creator>chen</dc:creator><description>&lt;p&gt;Not sure if this is relevant (perhaps, it is) - the Windows Server 2003 m/cs use the /3GB switch in the boot.ini file. &lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#4855395</link><pubDate>Mon, 10 Sep 2007 21:37:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4855395</guid><dc:creator>Marty </dc:creator><description>&lt;p&gt;This is a problem with WCF using the XmlSerializer!!!!!! &amp;nbsp; &amp;nbsp;[System.ServiceModel.XmlSerializerFormatAttribute()]&lt;/p&gt;
&lt;p&gt;Using Process Explorer, we see the temp assemblies growing unless we declare the client proxy as static. &amp;nbsp;Unfortunately a lot of developers will be hit by this problem if Microsoft does not get a fix. &amp;nbsp;The solution is not to use the DataContractSerializer (which we assume does not have the problem). &amp;nbsp;We would have to re-tool all our classes.&lt;/p&gt;
&lt;p&gt;This is a huge problem for our application which runs out of memory by the end of the day with 100 or so users. &amp;nbsp;This bug does not make moving to WebServices easier - Microsoft should release a patch for this immediately!!!!&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#4862279</link><pubDate>Tue, 11 Sep 2007 10:16:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4862279</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi Marty,&lt;/p&gt;
&lt;p&gt;I haven't really worked a whole lot with WCF so I don't know the details regarding the problem you're talking about but before going to deep into it I just want to see if it is a real problem or a percieved problem.&lt;/p&gt;
&lt;p&gt;When you call a webservice from ASP.NET for example you will also create dynamic assemblies for xml serialization of the parameters but you will only create one per type/method so after initially you will create a few but once they are all initialized they will be reused since they are created with the default constructors. &amp;nbsp; &amp;nbsp; Are you saying that with this construct you keep creating new ones throughout the life of the process? &amp;nbsp;I.e. if you call the same web service twice, will you create new assemblies? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you do continually create new ones for each call to the ws, please post some sample code and I will take a look if time permits or start a case with support. &amp;nbsp; If the 2nd call to a web service does not generate new assemblies your memory problem lies elsewhere. &amp;nbsp;You will need to generate at least one new assembly per type you serialize otherwise serialization will not work...&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#4868819</link><pubDate>Tue, 11 Sep 2007 22:06:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4868819</guid><dc:creator>Marty</dc:creator><description>&lt;p&gt;Hi Tess, thanks for the reply!!! &lt;/p&gt;
&lt;p&gt;just a summary again of what we are experiencing... we are trying to get this to Microsoft.&lt;/p&gt;
&lt;p&gt;We have experienced the documented XmlSerializer assembly leak problem reported by Microsoft as a problem with the .NET Framework 1.0, 1.1 and 2.0. &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://support.microsoft.com/kb/886385/en-us"&gt;http://support.microsoft.com/kb/886385/en-us&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Specifically, we use WCF to generate client proxies to WebServices and we also instruct WCF to use the XmlSerializerFormatter and not the DataContractFormatter.&lt;/p&gt;
&lt;p&gt;Because we rely on the XmlSerializerFormatter, we have no control over the WCF code that deserializes xml data streams into managed objects. &amp;nbsp;The call to Deserialize from the Service Model exhibits the problem. &amp;nbsp;The call to deserialize uses a constructor of the XmlSerializer that does not cache assemblies based on the type. &amp;nbsp;And it is very easy to duplicate by using Process/App Domain Viewer - Current and Total Assemblies counts grow.&lt;/p&gt;
&lt;p&gt;See stack trace below.&lt;/p&gt;
&lt;p&gt;We have a workaround whereby we cache the client proxy classes but we feel that this is not an ideal solution long term.&lt;/p&gt;
&lt;p&gt;Ideally, we would like a patch to the Service Model framework (WCF) that addresses the problem when invoking the XmlSerializer by caching the serializer in the assembly (as described) or better yet, a path to the XmlSerializer that implements caching in ALL constructors.&lt;/p&gt;
&lt;p&gt;Stack Trace (Crude cut and paste - please forgive me).&lt;/p&gt;
&lt;p&gt; 	qtnaxaft!Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer1.Deserialize(System.Xml.Serialization.XmlSerializationReader reader = {Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIPlanDesign}) + 0x40 bytes	&lt;/p&gt;
&lt;p&gt; 	System.Xml.dll!System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader xmlReader = {Element, Name=&amp;quot;a:OfferingCombination&amp;quot;}, string encodingStyle, System.Xml.Serialization.XmlDeserializationEvents events) + 0xa2 bytes	&lt;/p&gt;
&lt;p&gt; 	System.Xml.dll!System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader xmlReader, string encodingStyle) + 0x21 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(System.Xml.XmlDictionaryReader reader, System.ServiceModel.Channels.MessageVersion version, System.Xml.Serialization.XmlSerializer serializer, System.ServiceModel.Description.MessagePartDescription returnPart = Name={GetOfferingCombinationsResult}, Namespace=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://tempuri.org/&amp;quot;"&gt;http://tempuri.org/&amp;quot;&lt;/a&gt;, Type={System.Void}, Index=0}, System.ServiceModel.Description.MessagePartDescriptionCollection bodyParts = Count = 1, object[] parameters = {Dimensions:[1]}, bool isRequest = false) + 0x63 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(System.Xml.XmlDictionaryReader reader, System.ServiceModel.Channels.MessageVersion version, string action, System.ServiceModel.Description.MessageDescription messageDescription, object[] parameters, bool isRequest) + 0x137 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(System.ServiceModel.Channels.Message message, object[] parameters, bool isRequest) + 0x95 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(System.ServiceModel.Channels.Message message, object[] parameters) + 0x198 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ref System.ServiceModel.Dispatcher.ProxyRpc rpc = {System.ServiceModel.Dispatcher.ProxyRpc}) + 0x33 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Channels.ServiceChannel.HandleReply(System.ServiceModel.Dispatcher.ProxyOperationRuntime operation = {System.ServiceModel.Dispatcher.ProxyOperationRuntime}, ref System.ServiceModel.Dispatcher.ProxyRpc rpc = {System.ServiceModel.Dispatcher.ProxyRpc}) + 0xd8 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Channels.ServiceChannel.EndCall(string action, object[] outs, System.IAsyncResult result) + 0xde bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(System.Runtime.Remoting.Messaging.IMethodCallMessage methodCall = {System.Runtime.Remoting.Messaging.Message}, System.ServiceModel.Dispatcher.ProxyOperationRuntime operation = {System.ServiceModel.Dispatcher.ProxyOperationRuntime}) + 0x45 bytes	&lt;/p&gt;
&lt;p&gt; 	System.ServiceModel.dll!System.ServiceModel.Channels.ServiceChannelProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage message = {System.Runtime.Remoting.Messaging.Message}) + 0x81 bytes	&lt;/p&gt;
&lt;p&gt; 	mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref System.Runtime.Remoting.Proxies.MessageData msgData, int type) + 0x273 bytes	&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#5245874</link><pubDate>Tue, 02 Oct 2007 20:52:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5245874</guid><dc:creator>Chad</dc:creator><description>&lt;p&gt;Can/does the same problem occur if you implement iXmlSerializable in an ASP.Net application.&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#5255814</link><pubDate>Wed, 03 Oct 2007 09:35:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5255814</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi Chad,&lt;/p&gt;
&lt;p&gt;The only reason it would make the same problem occurr would be if someone called new XmlSerializer with one of the constructors listed above... &amp;nbsp; just implementing iXmlSerializable would not cause an issue...&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#5595266</link><pubDate>Mon, 22 Oct 2007 12:45:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5595266</guid><dc:creator>GuillaumeB</dc:creator><description>&lt;p&gt;Hi Tess,&lt;/p&gt;
&lt;p&gt;I'm currently working on a big project involving several WCF services. We have big performance and memory consumption problems for 3 of them. &lt;/p&gt;
&lt;p&gt;These 3 services are actually designed to act as gateways for external partners Java webservices. &lt;/p&gt;
&lt;p&gt;We used svcutil to generate the client proxy to call these services and we saw that WCF runtime is generating an on-the-fly XMLSerializer assembly *for each call* to the remote WS. As you described, we saw that unfortunately a new assembly is generated each time we call the same method.&lt;/p&gt;
&lt;p&gt;We tried many things to solve this problem : SGEN generation, we also tried to used different option of the svcutil generation to change the type of Formatter(DataContractFormatter, XmlSerializerFormatter),...&lt;/p&gt;
&lt;p&gt;But - as marty explainded in his comment- we're also running out of memory during our load test with only 100 users.&lt;/p&gt;
&lt;p&gt;We're exploring this problem with the MS premium support because we think that our perf and memory leak problem is coming from this strange WCF behaviour but we're running out of ideas and the problem is still there !&lt;/p&gt;
&lt;p&gt;Do you have any news of Marty's problem? &lt;/p&gt;
&lt;p&gt;Do you know if a fix has been published?&lt;/p&gt;
&lt;p&gt;Thanks a lot!&lt;/p&gt;</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#5596958</link><pubDate>Mon, 22 Oct 2007 14:15:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5596958</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;To be honest I haven't worked with WCF enough to be able to give you any answers off-hand. &amp;nbsp;For &amp;quot;normal&amp;quot; webservices you would only create one per type, but perhaps WCF uses one of the non-standard constructors... One idea, in order to figure out if this is the case, would be to run a test in a controlled environment where you set a breakpoint with !bpmd -md &amp;lt;methoddesc&amp;gt; on the different XmlSerializer..ctor &amp;nbsp;(constructors)&lt;/p&gt;
&lt;p&gt;you can get the method descriptors by doing !dumpheap to find the methodtable for XmlSerializer and then doing !dumpmt -md on that methodtable.&lt;/p&gt;
&lt;p&gt;At least that could tell you why you create new assemblies all the time.&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#6890007</link><pubDate>Sat, 29 Dec 2007 02:49:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6890007</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;We have the exact same issue... new assemblies getting created on every call. &amp;nbsp;We have contracts for every object but am still seeing many references to:&lt;/p&gt;
&lt;p&gt; [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]&lt;/p&gt;
&lt;p&gt;Is there any update on a solution?&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#6910400</link><pubDate>Mon, 31 Dec 2007 02:45:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6910400</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;For us it appears the issue is solved with .NET 2.0 SP1 that was released on 12/27. &amp;nbsp;We are confirming with more tests but it appears fixed. &amp;nbsp;And performance appears 100 times faster.&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7040178</link><pubDate>Wed, 09 Jan 2008 16:32:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7040178</guid><dc:creator>flyingchen</dc:creator><description>&lt;p&gt;i'm not good at english :(&lt;/p&gt;
&lt;p&gt;i happened Marty's problem and solved it ! we use wcf to call services ,and so of the service are .asmx . And the proxy of the .asmx service is the problem . It serializ and deserialize every time that we call it. so the cup and memory are very high. &lt;/p&gt;
&lt;p&gt;just do :&lt;/p&gt;
&lt;p&gt;we use a object pool that cache the client proxy.&lt;/p&gt;
&lt;p&gt;code:&lt;/p&gt;
&lt;p&gt;public interface IWcfClientPoolElement&amp;lt;TClient&amp;gt; where TClient : IWcfClientPoolElement&amp;lt;TClient&amp;gt;, new()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WcfClientPool&amp;lt;TClient&amp;gt; Pool&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;get;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public class WcfClientPool&amp;lt;TClient&amp;gt; where TClient : IWcfClientPoolElement&amp;lt;TClient&amp;gt;, new()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private Stack&amp;lt;TClient&amp;gt; m_container;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private int m_currentCount;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private int m_capacity;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private object m_mutex; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public WcfClientPool() : this(20) { }&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public WcfClientPool(int capacity)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.m_capacity = capacity;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.m_container = new Stack&amp;lt;TClient&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.m_mutex = new object();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.m_currentCount = 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public TClient GetClient()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (true)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lock (this.m_mutex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (this.m_container.Count &amp;gt; 0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return this.m_container.Pop();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if (this.m_currentCount &amp;lt; this.m_capacity)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.m_currentCount++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TClient client = new TClient();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;client.Pool = this;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return client;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Thread.SpinWait(100);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void Restore(TClient client)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lock (m_mutex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.m_container.Push(client);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;and &lt;/p&gt;
&lt;p&gt;client code like this :&lt;/p&gt;
&lt;p&gt;[System.Diagnostics.DebuggerStepThroughAttribute()]&lt;/p&gt;
&lt;p&gt;[System.CodeDom.Compiler.GeneratedCodeAttribute(&amp;quot;System.ServiceModel&amp;quot;, &amp;quot;3.0.0.0&amp;quot;)]&lt;/p&gt;
&lt;p&gt;public partial class I_UserSoapClient : System.ServiceModel.ClientBase&amp;lt;I_UserSoap&amp;gt;, I_UserSoap,System.IDisposable,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Temporary.IWcfClientPoolElement&amp;lt;I_UserSoapClient&amp;gt;&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;private Temporary.WcfClientPool&amp;lt;I_UserSoapClient&amp;gt; pool = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;void System.IDisposable.Dispose()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Pool.Restore(this);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;.....&lt;/p&gt;
&lt;p&gt;if you have any question ,please add me msn : flyingchen@live.com&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7040192</link><pubDate>Wed, 09 Jan 2008 16:35:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7040192</guid><dc:creator>flyingchen</dc:creator><description>&lt;p&gt;we can use below way to use the proxy :&lt;/p&gt;
&lt;p&gt;using (I_UserSoapClient objClient = pool.GetClient())&lt;/p&gt;
</description></item><item><title>Using Reflector to search through code and resolve .NET issues</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7055658</link><pubDate>Thu, 10 Jan 2008 16:20:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7055658</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;As you already know, i spend my days analyzing dumps for customers, and more often than not I don't have&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7633065</link><pubDate>Tue, 12 Feb 2008 09:07:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7633065</guid><dc:creator>Joel</dc:creator><description>&lt;p&gt;First off, I'm so glad that I found this post. &amp;nbsp;It makes complete sense as to what is happening with my code.&lt;/p&gt;
&lt;p&gt;I've also run into the same behavior that Marty noted about WCF services creating temporary serialization assemblies. &amp;nbsp;I created a Windows Service that runs a polling thread to pickup messages from a WCF service. &amp;nbsp;The polling thread uses a WCF client to invoke the remote service to get a list of available messages. &amp;nbsp;The WCF client is then used to download each message. &amp;nbsp;Everytime the polling thread executes, it creates a WCF client instance. &amp;nbsp;This results in a temporary assembly being generated each time for the types used by the client.&lt;/p&gt;
&lt;p&gt;We are using the .NET 3.0 Framework. &amp;nbsp;I have not tried using .NET 3.5 to see if the issue has been fixed, as 3.5 is not available in our production environment.&lt;/p&gt;
&lt;p&gt;It seems my only solution is to either cache WCF client instance, which won't solve the problem if the client has to be closed. &amp;nbsp;This will only minimize the problem, not solve it. &amp;nbsp;The other solution is to create an AppDomain, load the WCF client into that and execute the client methods from there. &amp;nbsp;The AppDomain can then be unloaded when necessary. &amp;nbsp;This seems like a bit of a kludge to me. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'm really glad I found this article though. &amp;nbsp;I should be able to get some sleep now that I know what the problem is.&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7634564</link><pubDate>Tue, 12 Feb 2008 10:32:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7634564</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi Joel,&lt;/p&gt;
&lt;p&gt;I have to say that i haven't played at all with WCF services and usually WCF issues are handled by a different support team which is why I haven't run into this before. &amp;nbsp;Now you make me curious, I think I'll have to look into this and see how it works.&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7658980</link><pubDate>Wed, 13 Feb 2008 04:20:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7658980</guid><dc:creator>Joel</dc:creator><description>&lt;p&gt;The problem has me really confused because I'm not doing anything special with the WCF client instances. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The WCF client code was created with svcutil.exe and the resulting client code file (C#) imported into the project. &amp;nbsp;I couldn't use &amp;quot;Add Service Reference&amp;quot; from the IDE because the VS2005 install that I'm using on the R&amp;amp;D box does not have the Orcas extensions. &amp;nbsp;The WCF service interface was annotated with the XmlSerializerFormatAttribute class.&lt;/p&gt;
&lt;p&gt;Anyhow, while debugging the Windows Service, everytime I instantiate the client, a temporary serialization assembly is loaded. &amp;nbsp;It's as if the internal XmlSerializer is not caching the types as noted in your article. &amp;nbsp;Eventually the memory footprint grows into the hundreds of megabytes and that is obviously not something the server administrators are going to like. :)&lt;/p&gt;
&lt;p&gt;At first I thought this might be an issue with the way I had designed the program. &amp;nbsp;Essentially, the Windows Service is downloading the XML documents from a WCF service that I created to interacts with an ebMS product called Hermes (which is an open-source Java-based ebMS application.) &amp;nbsp;My Windows Service checks each configured partnership for messages by queuing up a command object using ThreadPool.QueueUserWorkItem. &amp;nbsp;Therefore, the WCF client is instantiated and executed in thread-pool thread. &amp;nbsp;I speculated that this might be the problem with the XmlSerializer not caching the types, but it turns out I was wrong. &amp;nbsp;Even if I execute the command object on a non-threadpool thread, the program still exhibits the same behavior.&lt;/p&gt;
&lt;p&gt;I'm in the process of recreating the code under VS2008 and .NET 3.0 on my own personal development machine, to see if, for whatever reason, there is an issue with the VS2005/.NET 2.0/3.0 install on the R&amp;amp;D box.&lt;/p&gt;
&lt;p&gt;Thank you again for your interest. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#7667670</link><pubDate>Wed, 13 Feb 2008 11:26:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7667670</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Feel free to send me a repro offline if you want... &lt;/p&gt;
&lt;p&gt;I can't promise that I will look at it or that I will have any insightful information if I look at it because of time constraints and because, as I mentioned, I've haven't played much with WCF.&lt;/p&gt;
&lt;p&gt;Still I am very curious so feel free to send it and I'll take a look if time permits.&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#8326201</link><pubDate>Wed, 19 Mar 2008 23:19:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8326201</guid><dc:creator>Riaz M</dc:creator><description>&lt;p&gt; &amp;nbsp; &amp;nbsp;public class serv : System.Web.Services.WebService&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public struct ee&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public string[] foo;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public int bar;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[WebMethod]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public ee HelloWorld()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ee eee = new ee();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;eee.foo = new string[] { &amp;quot;test1&amp;quot;, &amp;quot;test2&amp;quot; };&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;eee.bar = 434;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return eee;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;If i invoke with HTTP POST (/service.asmx/HelloWorld) it returns a XML as it should BUT it adds 100k to memory everytime it's called and in the dump there are eventually thousands of types of &lt;/p&gt;
&lt;p&gt;xml.serialization.generatedassembly.arrayofstringserializer&lt;/p&gt;
&lt;p&gt;which is adding up to 1.2gb of memory&lt;/p&gt;
&lt;p&gt;How can i implement cache if i'm not actually calling XMLSerializer?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#8327201</link><pubDate>Thu, 20 Mar 2008 13:27:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8327201</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;typically a webservice call would only generate one dynamic assembly since it would be using the new xmlserializer(type) but perhaps there is something going on here with the struct.&lt;/p&gt;
&lt;p&gt;I am on easter vacation at the moment so I dont have access to all my tools but it sounds very interesting so I will definitely look into it. &amp;nbsp;If I find something I will probably post it as a separate post.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#8420825</link><pubDate>Thu, 24 Apr 2008 08:24:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8420825</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Would there be a way to configure the .NET sampling profiler to profile everytime an assembly is loaded? That way we could find out which calls are causing it to happen.&lt;/p&gt;</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#8420914</link><pubDate>Thu, 24 Apr 2008 09:22:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8420914</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;I dont know if you can configure the .net sampling profiler, not exactly sure which tool you are referring to, but you can either a) use debug diag with leaktracking turned on, which will give you stacks for when you're allocating memory on the loaderheap, or b) you could potentially create an adplus script that broke on load module and capture the stacks... &lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#8749187</link><pubDate>Fri, 18 Jul 2008 16:24:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8749187</guid><dc:creator>Asutosh</dc:creator><description>&lt;p&gt;Hi Tess&lt;/p&gt;
&lt;p&gt;This is a really nice article. Thanks for putting it online. We have a similar memory leak issue for which I am currently working with Microsoft engineers to get it resolved. On intilal investigation, they say there are lots of dynamic assemblies of XmlSerializer. As per MS, we should use XmlSerializer(type) constructor to avoid loading new assemblies. I searched on whole solution and the only constructor I see being used is XmlSerializer(type) and .NET still seems to load a new assembly for every instantiation. BTW, my application is in .NET 2.0. The MS engineer wants me to run sgen.exe on the project that contains entities which are serialized and then just put the xyz.XmlSerializer.dll in the bin directory of the web projects which using the XmlSerializer object. I am not really convince that this will fix the problem. Please recommend. Thanks&lt;/p&gt;
</description></item><item><title>re: .NET Memory Leak: XmlSerializing your way to a Memory Leak</title><link>http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-your-way-to-a-memory-leak.aspx#8831993</link><pubDate>Mon, 04 Aug 2008 22:45:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831993</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;It's a bit hard to comment on that just with this information... if you are not doing anything with any other constructors than XmlSerializer(type) then the issue is probably the amount and complexity of the items being serialized and in that case using sgen is usually one of the recommended ways to reduce the memory used for the serialization assemblies&lt;/p&gt;
</description></item></channel></rss>