Why do Asp.net timers/updatepanels leak memory and can it be fixed/worked around?

Posted by KallDrexx on Stack Overflow See other posts from Stack Overflow or by KallDrexx
Published on 2010-06-16T13:53:39Z Indexed on 2010/06/16 14:02 UTC
Read the original article Hit count: 506

I have built a suite of internal websites for our company to manage some of our processes. I have been noticing that these pages have massive memory leaks that cause the pages to be using well over 150mb of memory, which is ridiculous for a webpage that consists of a single form and a GridView that is displaying 7-10 rows of data at a time, sometimes with the data not changing for a whole day. This data does need to be refreshed on a semi-regular basis so that we always see the latest results and can act on them.

After some testing it appears that the memory leak is extremely easy to reproduce, and very noticeable. I created a page with the following asp.net markup:

<body>
<form id="form1" runat="server">
<div>
    <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>    
    <asp:Timer ID="timer1" runat="server" Interval="1000" />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    </ContentTemplate>
    </asp:UpdatePanel>
</div>
</form>
</body>

There is absolutely no code behind for this. This is the entirety of the page. Running this site in Chrome shows the memory usage shoot up to 25 megs in the span of 20-30 seconds. Leaving it running for a few minutes makes the memory go up to the 70 megs and such.

Am I using timers and update panels wrong, or is this a pure Asp.net issue with no work around?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about memory-leaks