Hi,
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;
}</script><html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><form id="form2" runat="server"><div style="padding-top: 10px"><asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><fieldset><legend>UpdatePanel</legend><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></fieldset></ContentTemplate></asp:UpdatePanel></div></form></body></html>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.
Ronald