I have a GridView that is bound to an ObjectDataSource that is calling a Business Service object which returns a List<> of POCO's.
Recently my client removed the Page Limit number on the GridView due to their customer's request. This resulted in the GridView displaying over 10K items.
When this page is called we're seeing the ASP.NET process eat up roughly 30MB on each refresh and not letting it go. (eventually the web server throws an out of memory exception)
I'm 100% certain this is not the BSO (I've created a page that calls the BSO 20 times and seen no memory leak). I ran the ANTS Profiler and saw that most of the memory is indeed from the Web UI.
<asp:TextBox ID="uxQuery" runat="server" Width="300px" MaxLength="300"></asp:TextBox>
<asp:Button ID="uxSearch" runat="server" Text="Search" OnClick="uxSearch_Click" />
<asp:GridView ID="GridView1" Width="100%" Visible="True" DataSourceID="MyDataSource"
runat="server" AllowSorting="True" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound" EnableViewState="False">
<PagerSettings FirstPageText="<<" LastPageText=">>" Mode="NumericFirstLast"
NextPageText=">" PreviousPageText="<"></PagerSettings>
<Columns>
<asp:TemplateField HeaderText="Name" SortExpression="OrganizationName">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("Name") %>' CommandName="Name"
CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CityName" HeaderText="City" SortExpression="CityName" />
<asp:BoundField DataField="PhoneNumber" HeaderText="Phone" SortExpression="PhoneNumber" />
</Columns>
<HeaderStyle CssClass="MasterHeader" />
<AlternatingRowStyle CssClass="AlternateRow" />
</asp:GridView>
<asp:ObjectDataSource ID="MyDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetBySearchString" TypeName="BLL.BSO.SummaryBSO"
SortParameterName="sortExpression" EnablePaging="True">
<SelectParameters>
<asp:ControlParameter ControlID="uxQuery" Name="searchString" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
I've talked my client and customer out of this "feature" but I'm still curious why the memory leak exists.