<?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>ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx</link><description>I get enough issues relating to bad perf caused by large viewstate that I felt like it is time to dedicate some blog space to it, so here is a typical problem description for this type of problem. Problem description: Under high load the ASP.NET application</description><dc:language>sv-SE</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1141660</link><pubDate>Fri, 24 Nov 2006 20:41:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1141660</guid><dc:creator>AndrewSeven</dc:creator><description>&lt;p&gt;Most cases where I have seen excessive viewstate, there have been one or many things on the page that have viewstate enabled, but which don't actual use the viewstate on postback.&lt;/p&gt;
&lt;p&gt;Its not always so easy, but selectively turning off viewstate on some controls goes a long way towards keeping it under control.&lt;/p&gt;
&lt;p&gt;I find it unfortunate that I can't easily turn off viewstate &amp;quot;by default&amp;quot; an then selectively turn it on for certain pages or turn it off &amp;quot;by default&amp;quot; for a page and only turn it on for some controls. I always have to go the other way, leaving it on globally and trying to turn it off case by case.&lt;/p&gt;
&lt;p&gt;(I haven't dug into this in 2.0 to see if its the same as 1.x )&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1141733</link><pubDate>Fri, 24 Nov 2006 20:59:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1141733</guid><dc:creator>Chris Love</dc:creator><description>&lt;p&gt;This is so true. &amp;nbsp;ViewState is a real performance killer. &amp;nbsp;I am doing some refinement of how I handle ViewState, &lt;a rel="nofollow" target="_new" href="http://professionalaspnet.com/blogs/aspnet_blog/archive/2006/11/16/Persist-the-ViewState-and-Increase-ASP.NET-Performance.aspx"&gt;http://professionalaspnet.com/blogs/aspnet_blog/archive/2006/11/16/Persist-the-ViewState-and-Increase-ASP.NET-Performance.aspx&lt;/a&gt;. &amp;nbsp; I plan on posting an update to this in the next week or so. &amp;nbsp;One thing I have learned is to not use the GridView Control and minimize the use of any other Web Control in a grid format or on the page itself. &amp;nbsp;I had a client call me in at the last day before a deadline because they were dumping about 30 MB into viewstate so there would be no postback to process data. &amp;nbsp;Similar to your scenario. &amp;nbsp;I told them to just re-architech and take an extra week.&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1141755</link><pubDate>Fri, 24 Nov 2006 21:03:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1141755</guid><dc:creator>Ted Jardine</dc:creator><description>&lt;p&gt;Picky? I hardly call that picky ;-)&lt;/p&gt;</description></item><item><title>Interesting Finds: Week of Thanksgiving 1</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1155118</link><pubDate>Mon, 27 Nov 2006 00:23:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1155118</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>Interesting Finds: Week of Thanksgiving 1</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1155130</link><pubDate>Mon, 27 Nov 2006 00:30:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1155130</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>Death by ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1160725</link><pubDate>Mon, 27 Nov 2006 22:08:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1160725</guid><dc:creator>Weblog di Fabio Cozzolino</dc:creator><description>&lt;p&gt;Uno dei blog che maggiormente seguo &amp;#232; quello di Tess Ferrandezprincipalmente incentrato su pratiche di&lt;/p&gt;
</description></item><item><title>Link Listing - November 28, 2006</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1169580</link><pubDate>Wed, 29 Nov 2006 07:24:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1169580</guid><dc:creator>Christopher Steen</dc:creator><description>&lt;p&gt;Common Gotcha: Don't forget to when adding providers [Via: ScottGu ] Mounting ISO Images with Vista...&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1184997</link><pubDate>Fri, 01 Dec 2006 18:26:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1184997</guid><dc:creator>Milan Negovan</dc:creator><description>&lt;p&gt;Thank you for another great post, Tess!&lt;/p&gt;
&lt;p&gt;ASP.NET 2.0 has these really cool &amp;quot;page state persisters&amp;quot; which allow you to store view state elsewhere (see &lt;a rel="nofollow" target="_new" href="http://www.aspnetresources.com/blog/page_state_persisters_overview.aspx"&gt;http://www.aspnetresources.com/blog/page_state_persisters_overview.aspx&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Even though we're always on the lookout for ways to cut view state in our pages, at times you can't escape it, so we chose to store it in the database. &lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1612731</link><pubDate>Tue, 06 Feb 2007 19:44:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1612731</guid><dc:creator>Seth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a question about high memory usage. We have an issue with one of our SQL servers that results in data not being returned to the application in a timely mannor. when this happens, the connection pool count increases, the number of asp.net requests current increases, and in some cases, the process size jumps from ~200 MB to 400 - 600 MB. In several cases, I have taken a process dump and observed the following from a dumpheap -stat:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MT &amp;nbsp; &amp;nbsp; &amp;nbsp;Count &amp;nbsp; &amp;nbsp; TotalSize Class Name&lt;/p&gt;
&lt;p&gt;0x000fd210 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;444 &amp;nbsp; 458,348,564 &amp;nbsp; &amp;nbsp; &amp;nbsp;Free &lt;/p&gt;
&lt;p&gt;it seems to be high memory usage allocated by 'Free' - is there a way I can determine what's going on here. &lt;/p&gt;
&lt;p&gt;thanks.&lt;/p&gt;
&lt;p&gt;Seth&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1617475</link><pubDate>Wed, 07 Feb 2007 10:37:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1617475</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Wow, that is extremely large free sections.&lt;/p&gt;
&lt;p&gt;There is two common ways that you end up with those&lt;/p&gt;
&lt;p&gt;If you dump out !dumpheap -mt 0x00fd210 -min 100000 &amp;nbsp; to get the ones over 100 k, and then compare the addresses of the objects with the output of !eeheap -gc you can check if they fall in one of the small object segments or on the large object segments&lt;/p&gt;
&lt;p&gt;1. If they are on the LOH you have probably allocated a lot of large objects at the same time and just deallocated them. &amp;nbsp;Since not much if any relocation is done on the LOH you can get a lot of fragmentation here.&lt;/p&gt;
&lt;p&gt;You can run dc on some of the addresses to get a feel for what used to be here, or look at other large objects to get a pattern.&lt;/p&gt;
&lt;p&gt;2. If they are on the small object heap, perhaps you are pinning a lot. &amp;nbsp;Look at the amount of pinned objects in perfmon for the process or run !gchandles to see how many pinned objects there are. &amp;nbsp;Since you can't relocated when pinning you'll get a lot of fragmentation then, but in 2.0 that is not so common. &lt;/p&gt;
&lt;p&gt;/Tess&lt;/p&gt;
</description></item><item><title>High CPU in GC and other badness caused by SetProcessAffinityMask</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#1865696</link><pubDate>Mon, 12 Mar 2007 18:31:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1865696</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;I thought I'd share a support story with you from a very interesting case I have. My customer is running&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#4716019</link><pubDate>Mon, 03 Sep 2007 06:55:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4716019</guid><dc:creator>.rip</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I confronted with that problem too. But, I don't understand, why Microsoft's developers didn't fixed this problem. I wrote scipt for &amp;quot;adplus&amp;quot; and run his when CPU-loading was about 100%. Body of script:&lt;/p&gt;
&lt;p&gt;&amp;lt;ADPlus&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Settings&amp;gt;&lt;/p&gt;
&lt;p&gt;	&amp;lt;Sympath&amp;gt;&lt;/p&gt;
&lt;p&gt;		c:\windows\symbols&lt;/p&gt;
&lt;p&gt;	&amp;lt;/Sympath&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;RunMode&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CRASH&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/RunMode&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Option&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Quiet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Option&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/Settings&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;PreCommands&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Cmd&amp;gt; .load clr10\sos.dll &amp;nbsp;&amp;lt;/Cmd&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/PreCommands&amp;gt;&lt;/p&gt;
&lt;p&gt;	&amp;lt;Exceptions&amp;gt;&lt;/p&gt;
&lt;p&gt;		&amp;lt;Option&amp;gt;&lt;/p&gt;
&lt;p&gt;			NoDumpOnFirstChance&lt;/p&gt;
&lt;p&gt;		&amp;lt;/Option&amp;gt;&lt;/p&gt;
&lt;p&gt;	&amp;lt;/Exceptions&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Breakpoints&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;NewBP&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Address&amp;gt;&lt;/p&gt;
&lt;p&gt;	mscorsvr!gc_heap::allocate_large_object&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Address&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Type&amp;gt;&lt;/p&gt;
&lt;p&gt;		BP&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Type&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Actions&amp;gt;&lt;/p&gt;
&lt;p&gt;		Stack&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Actions&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;CustomActions&amp;gt;&lt;/p&gt;
&lt;p&gt;	!clrstack;&lt;/p&gt;
&lt;p&gt;&amp;lt;/CustomActions&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ReturnAction&amp;gt;&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; G&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ReturnAction&amp;gt; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/NewBP&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/Breakpoints&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/ADPlus&amp;gt;&lt;/p&gt;
&lt;p&gt;Then, I analyzed LOG-file and selected method calls which repeated many times:&lt;/p&gt;
&lt;p&gt;Current stack below ---&lt;/p&gt;
&lt;p&gt; # ChildEBP RetAddr &amp;nbsp;Args to Child &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;00 02b5f170 792117f6 00014c6c 00000000 00014c6c mscorsvr!gc_heap::allocate_large_object (FPO: [Non-Fpo])&lt;/p&gt;
&lt;p&gt;01 02b5f390 791b6269 023dd040 00014c6c 00000000 mscorsvr!GCHeap::Alloc+0x15b (FPO: [Non-Fpo])&lt;/p&gt;
&lt;p&gt;02 02b5f3a4 791b8873 00014c6c 00000000 00000000 mscorsvr!Alloc+0x3a (FPO: [Non-Fpo])&lt;/p&gt;
&lt;p&gt;03 02b5f3c4 791b8814 02000088 0000a630 00000000 mscorsvr!FastAllocatePrimitiveArray+0x45 (FPO: [Non-Fpo])&lt;/p&gt;
&lt;p&gt;04 02b5f444 0aa64982 02b5f488 223d1cc8 00000000 mscorsvr!JIT_NewArr1+0xbb (FPO: [Non-Fpo])&lt;/p&gt;
&lt;p&gt;WARNING: Frame IP not in any known module. Following frames may be wrong.&lt;/p&gt;
&lt;p&gt;05 02b5f474 791b1967 01ff2d03 00000000 184d3ba8 0xaa64982&lt;/p&gt;
&lt;p&gt;06 02b5f47c 00000000 184d3ba8 02b5f4b8 0aa64649 mscorsvr!JIT_Stelem_Ref+0x49 (FPO: [Non-Fpo])&lt;/p&gt;
&lt;p&gt; Executing custom commands: !clrstack;&lt;/p&gt;
&lt;p&gt;Thread 22&lt;/p&gt;
&lt;p&gt;ESP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EIP &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;0x02b5f414 &amp;nbsp;0x791d550d [FRAME: HelperMethodFrame] &lt;/p&gt;
&lt;p&gt;0x02b5f44c &amp;nbsp;0x0aa64982 [DEFAULT] [hasThis] String System.Web.UI.LosFormatter.ConsumeOneToken()&lt;/p&gt;
&lt;p&gt;0x02b5f460 &amp;nbsp;0x0aa64739 [DEFAULT] [hasThis] Object System.Web.UI.LosFormatter.DeserializeValueInternal()&lt;/p&gt;
&lt;p&gt;0x02b5f490 &amp;nbsp;0x0aa64649 [DEFAULT] [hasThis] Object System.Web.UI.LosFormatter.DeserializeValueInternal()&lt;/p&gt;
&lt;p&gt;0x02b5f4c0 &amp;nbsp;0x0aa644c9 [DEFAULT] [hasThis] Object System.Web.UI.LosFormatter.DeserializeValueInternal()&lt;/p&gt;
&lt;p&gt;0x02b5f4f0 &amp;nbsp;0x0aa6450e [DEFAULT] [hasThis] Object System.Web.UI.LosFormatter.DeserializeValueInternal()&lt;/p&gt;
&lt;p&gt;0x02b5f520 &amp;nbsp;0x0aa6453c [DEFAULT] [hasThis] Object System.Web.UI.LosFormatter.DeserializeValueInternal()&lt;/p&gt;
&lt;p&gt;0x02b5f550 &amp;nbsp;0x0aa642dc [DEFAULT] [hasThis] Object System.Web.UI.LosFormatter.Deserialize(String)&lt;/p&gt;
&lt;p&gt;0x02b5f578 &amp;nbsp;0x0aa6401e [DEFAULT] [hasThis] Object System.Web.UI.Page.LoadPageStateFromPersistenceMedium()&lt;/p&gt;
&lt;p&gt;0x02b5f5b0 &amp;nbsp;0x0aa63e6b [DEFAULT] [hasThis] Void System.Web.UI.Page.LoadPageViewState()&lt;/p&gt;
&lt;p&gt;0x02b5f5cc &amp;nbsp;0x038c74f8 [DEFAULT] [hasThis] Void System.Web.UI.Page.ProcessRequestMain()&lt;/p&gt;
&lt;p&gt;0x02b5f610 &amp;nbsp;0x038c4e67 [DEFAULT] [hasThis] Void System.Web.UI.Page.ProcessRequest()&lt;/p&gt;
&lt;p&gt;0x02b5f64c &amp;nbsp;0x038c48d3 [DEFAULT] [hasThis] Void System.Web.UI.Page.ProcessRequest(Class System.Web.HttpContext)&lt;/p&gt;
&lt;p&gt;0x02b5f654 &amp;nbsp;0x0269e9c4 [DEFAULT] [hasThis] Void System.Web.HttpApplication/CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()&lt;/p&gt;
&lt;p&gt;0x02b5f664 &amp;nbsp;0x024fe6d0 [DEFAULT] [hasThis] Class System.Exception System.Web.HttpApplication.ExecuteStep(Class IExecutionStep,ByRef Boolean)&lt;/p&gt;
&lt;p&gt;0x02b5f6ac &amp;nbsp;0x024fdd32 [DEFAULT] [hasThis] Void System.Web.HttpApplication.ResumeSteps(Class System.Exception)&lt;/p&gt;
&lt;p&gt;0x02b5f6f4 &amp;nbsp;0x024fdbfb [DEFAULT] [hasThis] Class System.IAsyncResult System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(Class System.Web.HttpContext,Class System.AsyncCallback,Object)&lt;/p&gt;
&lt;p&gt;0x02b5f710 &amp;nbsp;0x022ece3f [DEFAULT] [hasThis] Void System.Web.HttpRuntime.ProcessRequestInternal(Class System.Web.HttpWorkerRequest)&lt;/p&gt;
&lt;p&gt;0x02b5f74c &amp;nbsp;0x022ec9f0 [DEFAULT] Void System.Web.HttpRuntime.ProcessRequest(Class System.Web.HttpWorkerRequest)&lt;/p&gt;
&lt;p&gt;0x02b5f758 &amp;nbsp;0x022e8305 [DEFAULT] [hasThis] I4 System.Web.Hosting.ISAPIRuntime.ProcessRequest(I,I4)&lt;/p&gt;
&lt;p&gt;0x02b5f820 &amp;nbsp;0x79217188 [FRAME: ContextTransitionFrame] &lt;/p&gt;
&lt;p&gt;0x02b5f900 &amp;nbsp;0x79217188 [FRAME: ComMethodFrame] &lt;/p&gt;
&lt;p&gt;Then, I look code of method named &amp;quot;ConsumeOneToken()&amp;quot; &lt;/p&gt;
&lt;p&gt;private string ConsumeOneToken()&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;int length = 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;while (this._current &amp;lt; this._deserializationData.Length)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch (this._deserializationData[this._current])&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;case ';':&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case '&amp;lt;':&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case '&amp;gt;':&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return new string(this._builder, 0, length);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case '\\':&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this._current++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (this._deserializationData[this._current] == 'e')&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;this._current++;&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;return string.Empty;&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;this._builder[length] = this._deserializationData[this._current];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;length++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;default:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this._builder[length] = this._deserializationData[this._current];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;length++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&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;this._current++;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (length &amp;gt;= this._builder.Length)&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;char[] destinationArray = new char[this._builder.Length + 0x30];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Array.Copy(this._builder, destinationArray, this._builder.Length);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this._builder = destinationArray;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this._recyclable = false;&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;return new string(this._builder, 0, length);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;and that code shocked me...&lt;/p&gt;
&lt;p&gt;Tess, please, can you have commenting this???&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#4718086</link><pubDate>Mon, 03 Sep 2007 09:30:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4718086</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi .rip.&lt;/p&gt;
&lt;p&gt;I am not really sure that I am following regarding what shocked you and what it is that should be fixed.&lt;/p&gt;
&lt;p&gt;In this particular case it is deserializing viewstate and in doing so it has to allocate 0x00014c6c bytes (85100 bytes). &amp;nbsp;The reason for this is that there are many controls on the page or some control on the page which is generating a lot of viewstate. &amp;nbsp;Most likely a datagrid with a lot of rows in it or a dropdown with a lot of entries. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you see a problem because of this, the best course of action would be to reduce the amount of viewstate generated by the page, both for the sake of mem usage/CPU but also for the sake of bandwidth, especially if you have customers potentially using dial-up or slow connections.&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#4719352</link><pubDate>Mon, 03 Sep 2007 11:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4719352</guid><dc:creator>.rip</dc:creator><description>&lt;p&gt;Thanks for answer!!!&lt;/p&gt;
&lt;p&gt;...developers could provide some options for buffer's initialization size (&amp;quot;_builder&amp;quot; in code), but haven't made this.&lt;/p&gt;
&lt;p&gt;The following code has surprised me:&lt;/p&gt;
&lt;p&gt;char[] destinationArray = new char[this._builder.Length + 0x30];&lt;/p&gt;
&lt;p&gt;Why &amp;quot;+0x30&amp;quot; ? Why not another value?&lt;/p&gt;
&lt;p&gt;In result, when size of ViewState (after encoding) exceeds 85000, webservice load CPU on 100% some seconds. &lt;/p&gt;
&lt;p&gt;In fact, solution &amp;quot;ViewState&amp;quot; was made very very bad.&lt;/p&gt;
&lt;p&gt;Fortunately, System.Web altered completely in ASP.NET 2.0&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Bad perf, high memory usage and high CPU in GC - Death By ViewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#4720448</link><pubDate>Mon, 03 Sep 2007 12:50:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4720448</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;I can't really comment on the code and why decisions were made since I didn't write it, but surely most code uses constants so why not 0x30:)&lt;/p&gt;
&lt;p&gt;Of course you are welcome to your own opinion about how viewstate was implemented, but if you ask me I would say viewstate is a pretty nice feature, considering how much it gives you for free in terms of state management. &amp;nbsp; &lt;/p&gt;
&lt;p&gt;If you don't like viewstate as it is implemented there is always the option of turning it off and/or implementing your own:) and I do encourage you to do so in the cases where the generic implementation doesn't fit your needs. &amp;nbsp;Especially when it comes to selecting which controls should or should not emit viewstate in a given page.&lt;/p&gt;
&lt;p&gt;Everything comes at a cost (cache, viewstate, session and any other state storage) and it is just a matter of finding the right trade-off and figuring out just the right amount that makes the applications performant and usable. &amp;nbsp;What I am trying to do with this blog is point out what the pitfalls are so that developers can make informed decisions regarding how to use the different features.&lt;/p&gt;
</description></item><item><title>【收藏】本周ASP.NET英文技术文章推荐[11/26 - 12/02] </title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#5775365</link><pubDate>Tue, 30 Oct 2007 05:48:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5775365</guid><dc:creator>Jacky_xu</dc:creator><description>&lt;p&gt;本周ASP.NET英文技术文章推荐[11/26-12/02]&lt;/p&gt;
&lt;p&gt;提醒：若朋友们想对英文文章进行翻译，则首先需要征得原作者的同意，以免日后导致无谓的版权纷争。以下内容节选自《中华人民共和国著作权法...&lt;/p&gt;
</description></item><item><title>Optimisation du ViewState - l'enregistrer sur le server via le SessionPageStatePersister</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#6956120</link><pubDate>Wed, 02 Jan 2008 18:46:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6956120</guid><dc:creator>Atteint de Javascriptite aiguë [Cyril DURAND]</dc:creator><description>&lt;p&gt;Il y a quelques temps je vous avez expliqu&amp;#233; comment modifier la fa&amp;#231;on dont le viewstate est enregistr&amp;#233;&lt;/p&gt;
</description></item><item><title>How does the GC work and what are the sizes of the different generations?</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#8402590</link><pubDate>Thu, 17 Apr 2008 15:14:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8402590</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;During our ASP.NET debugging chat there were many questions around the GC and the different generations.&lt;/p&gt;
</description></item><item><title>CLR Inside Out: Large Object Heap Uncovered</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#8584364</link><pubDate>Mon, 09 Jun 2008 11:22:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8584364</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;In many of my posts I have discussed performance issues and memory issues caused by excessive use of&lt;/p&gt;
</description></item><item><title>ASP.NET Memory - Identifying pages with high Viewstate</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#8936526</link><pubDate>Tue, 09 Sep 2008 15:56:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8936526</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;From time to time we get issues with high memory and performance issues due to massive viewstate. I have&lt;/p&gt;
</description></item><item><title>Debugging Large VIewState</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#9011777</link><pubDate>Thu, 23 Oct 2008 00:49:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9011777</guid><dc:creator>PFE - Developer Notes for the Field</dc:creator><description>&lt;p&gt;This week I have been working with a customer that had pretty large ViewStates that were getting pushed&lt;/p&gt;
</description></item><item><title>Debug Diag script for troubleshooting .NET 2.0 Memory leaks</title><link>http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx#9606674</link><pubDate>Tue, 12 May 2009 12:59:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9606674</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;I have put together a quick and dirty debug diag script for troubleshooting .net memory leaks. (attached&lt;/p&gt;
</description></item></channel></rss>