Memory leak with UpdatePanel RRS feed

  • Question

  • User1581072340 posted


    Below an example of a simple web form with an UpdatePanel, a Button, a Label, a TextBox, and a RequiredFieldValidator. When clicking the button multiple times I can see the memory usage is growing without ever being released.

    <%@ Page Language="C#" %>
    <!DOCTYPE html>
    <script runat="server">
        protected void Button1_Click(object sender, EventArgs e)
            Label1.Text = "Refreshed at " + DateTime.Now;
    <html xmlns="http://www.w3.org/1999/xhtml">
        <form id="form2" runat="server">
            <div style="padding-top: 10px">
                <asp:ScriptManager ID="ScriptManager2" runat="server">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br />
                            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
                            <asp:TextBox ID="TextBox1" runat="server" Text="abcd"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="X" runat="server" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>

    I think the combination UpdatePanel and RequiredFieldValidator is causing the issue. What I found is that the following collections are growing after every postback:
    - Sys.WebForms.PageRequestManager._instance._onSubmitStatements
    - document.getElementsByTagName('head')[0].childNodes

    I tried it in several ASP.NET version, including 4.5.2, with and without UnobtrusiveValidationMode. I do have some code to work around this issue, but it feels like a hack.

    Can anybody tell me if this is a known issue and if there is a good way to work around this. Thanks in advance.


    Wednesday, December 3, 2014 8:01 AM

All replies