Memory leak

Last post 03-26-2008 2:09 PM by kirchi. 8 replies.

Sort Posts:

  • Memory leak

    03-07-2007, 6:38 AM
    • Loading...
    • FredK
    • Joined on 03-07-2007, 11:18 AM
    • Posts 1

    I have been experiencing a memory leak in internet explorer while only having a script manager on the page (see example code below).  The memory leak adds 0.2MB - 2.5MB of memory to the iexplore.exe process on each page refresh. I have had colleagues try this in IE6 with a similar issue. Is there a particular reason for this or am I missing something? I installed IE7 independently and group policies are disabled to ensure no strange configuration related issues.

     

    Internet explorer version: 7.0.5730.11CO
    Microsoft.Web.Preview: 1.0.61025.0
    System.Web.Extension: 1.0.61025.0

     

    We have extended our intranet application with this but I cannot release this update if it is going to grind our users' workstations to a halt.

     

    Is anyone else experiencing this issue?

     

     

    <%@ Page Language="VB" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
            <%= now() %>
            </div>
        </form>
    </body>
    </html>
    
     

     

     

  • Re: Memory leak

    04-10-2007, 4:31 PM
    • Loading...
    • jcham
    • Joined on 04-10-2007, 8:23 PM
    • Posts 4

    Hi there, I think I have a similar, yet different problem.

    I tried your scenario and it didn't cause a leak for me, HOWEVER, when I used a scriptmanager with a datalist, a leak occured. This leak grows at .5-1Mb every page refresh. The growth is exacerbate by the reload/refresh-ing the page before the datalist finishes loading.

     I dont know why it happens, but I created/maintain the internal web app for our plant and it seems to balloon way too fast. Need help =(

     

    <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release" />

    <script type="text/javascript" language="javascript">

    setInterval(moo, 500)

    function moo()

    {

    window.location=

    'Default.aspx';

    }

    </script>

    <asp:DataList ID="dlPackageList" runat="server" RepeatColumns="6" HorizontalAlign="Center">

    <ItemTemplate>

    <table border="1">

    <tr>

    <td style="width: 110px;" align="center">

    <asp:ImageButton ID="ibtnPicture" runat="server" Height="120px" Width="105px" ImageUrl='<%# "./wheelimages/" + Eval("sPartName") + "_small.gif"%>' />

    <asp:TextBox ID="tbCounts" runat="server" CssClass="enlargedText" Height="25px" Width="100px" Style="font-size:16pt; text-align:center;" Text='<%# Eval("nQuantity") %>'/>

    </td>

    </tr>

    </table>

    </ItemTemplate>

    </asp:DataList>

     

  • Re: Memory leak

    04-10-2007, 4:37 PM
    • Loading...
    • jcham
    • Joined on 04-10-2007, 8:23 PM
    • Posts 4
    Oops, where's the edit button? :)

    I forgot the delay should be set to .1 seconds to see a more noticable leak.
  • Re: Memory leak

    04-11-2007, 10:59 AM
    • Loading...
    • jcham
    • Joined on 04-10-2007, 8:23 PM
    • Posts 4

    Good morning guys =)

    Still having the same issues, althoughit  really only seems to happen when I use a datalist/gridview with item templates that include images! I just tried the same reload script on a page that only contains text/calendars with events bounded and the memory didn't seem to grow at all. (~500-1000 iterations within 2 minutes).

    Forgot to mention that I am using the Ajax.net 1.0 release. Anyway, hopefully I am not alone in this problem, or is this a datalist/gridview leak? (doesn't seem like that though because when I used a datalist with the above script it doesnt leak, only when the scriptmanager is present)

    Further investigation is going~ I'll keep you guys posted. Any suggestions as to what to try next would be helpful!

  • Re: Memory leak

    04-12-2007, 3:20 PM
    • Loading...
    • jcham
    • Joined on 04-10-2007, 8:23 PM
    • Posts 4

    Good afternoon guys,

     after further investigation i found out a few more things.

    I tried 4 cases:
    5 images linked to
    1) 5 buttons (through style[background-image])
    2) 5 button images
    3) 5 images
    4) datalist
    in the first 3 cases I tried to bind it programmatically through code behind, and statically (when defining the element itself)

    In all 4 cases, when the ScriptManager is present, memory will leak when refreshing the page continuously, and when SM is not present, there is no leak. Also note that when the images are not bound, there is no leak in both W/ and W/O scriptmanager cases.

    Why am I trying to load up a lot of images? The premise is that the plant operators use a touchscreen interface and they need to see the associated part picture to aid in identifying the part to be inputted. 

    I am starting to get worried that this case is isolated to me and our machine setup.
    Try this code out please and see if your memory grows steadily.

    Default.aspx

    1    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%>
    2    
    3    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    4    <html xmlns="http://www.w3.org/1999/xhtml">
    5    <head id="Head1" runat="server">
    6        <title>Change</title>
    7    </head>
    8    <body>
    9        <form id="form1" runat="server">
    10           <script type="text/javascript" language="javascript">
    11           setInterval(moo, 150)
    12           function moo()
    13           {
    14            window.location='Default.aspx';
    15           }
    16           </script>
    17           <asp:ScriptManager ID="sm1" 
    18               runat="server" 
    19               EnablePartialRendering="true" 
    20               EnableViewState="False" 
    21               LoadScriptsBeforeUI="true"
    22               ScriptMode="Release"/>
    23   
    24           <asp:Image ID="Image1" runat="server" ImageUrl="~/WheelImages/156L_small.gif" />
    25           <asp:Image ID="Image2" runat="server" ImageUrl="~/WheelImages/157L_small.gif"/>
    26           <asp:Image ID="Image3" runat="server" ImageUrl="~/WheelImages/181L_small.gif"/>
    27           <asp:Image ID="Image4" runat="server" ImageUrl="~/WheelImages/182L_small.gif"/>
    28           <asp:Image ID="Image5" runat="server" ImageUrl="~/WheelImages/329N_small.gif"/>
    29           <asp:Image ID="Image6" runat="server" ImageUrl="~/WheelImages/330N_small.gif"/>
    30           <asp:Image ID="Image7" runat="server" ImageUrl="~/WheelImages/420N_small.gif"/>
    31           <asp:Image ID="Image8" runat="server" ImageUrl="~/WheelImages/516N_small.gif"/>
    32       </form>
    33       
    34   </body>
    35   </html>
    36   
    
    Default.aspx.cs 
    1    using System;
    2    using System.Data;
    3    using System.Configuration;
    4    using System.Web;
    5    using System.Web.Security;
    6    using System.Web.UI;
    7    using System.Web.UI.WebControls;
    8    using System.Web.UI.WebControls.WebParts;
    9    using System.Web.UI.HtmlControls;
    10   
    11   public partial class _Default : System.Web.UI.Page 
    12   {
    13       protected void Page_Load(object sender, EventArgs e)
    14       {
    15   
    16       }
    17   
    18   }
    
     (perhaps I should start a new topic, but I dont want to 'troll'/'spam' as some would put it)
     Please help Crying
  • Re: Memory leak

    04-13-2007, 8:50 AM
    • Loading...
    • Djarn
    • Joined on 06-08-2006, 7:14 PM
    • Posts 1

    $addHandler event registration leaks memory

    Everytime this page loads memory leaks, I am using drip to auto refresh the page and monitor memory usage:


    <html>
    <head>
      <script type="text/javascript" src="MicrosoftAjax.js"></script>
      <script type="text/javascript">
        function pageLoad(sender, eargs) {
            var mydiv = $get("mydiv");
            $addHandler(mydiv, "click", foo);
        }
        function foo() {
            alert("test");
        }
      </script> 
    </head>

    <body>
       <h1>Eat my memory!</h1>
       <div id="mydiv"></div> 
    </body>
    </html>

  • Re: Memory leak

    04-19-2007, 4:21 AM
    • Loading...
    • ckhro
    • Joined on 02-08-2007, 11:01 AM
    • Posts 25

    Hello everyone.

    This is not exactly an answer but might help out some of the readers of this post.

    I had a Web App with huge memory leaks in every postback on some forms.  After making several tests, I found out that those leaks were not produced by Scriptmanager nor UpdatePanel. 

    The memory leaks were produced by Ajax Toolkit CalendarExtender control.

    I removed these controls and the memory leaks dissapeared.  With the controls on the page, after a couple of postback my IExplore.exe process needed about 80mb!!!! of memory.  Without these controls, it hardly needs more than 40mb (HALF of the mem, WOW!!!)

    Hope this helps someone out. 

  • Re: Memory leak

    03-26-2008, 9:58 AM
    • Loading...
    • whartrat
    • Joined on 04-19-2006, 11:44 PM
    • Posts 7

    I am having similar issues.  I've a a page the with several toolkit controls (2 dropdown  extenders, couple of update panels) and on every page refresh in IE7, it's taking up an additional 2500-4000k in memory (seen in task manager).  so...

    I created a brand new application with one page and just a scriptmanager (and nothing else) and on every page fresh (in IE7)  its taking up 150-200k on every refresh.

     I've spent days trying to track down the issues using sIEve, Drip, and js memory leak detector.  I've send leaks from toolkit controls (such as the dropdownpanel)

     This whole problem compounds itself because our site polls (for chat using jsjac) on a regular interval.  So if I leave my page open over night IE/Firefox will easily chew up to a gig of memory.  That's right a gig. 

     
    This is not related to closures or careless programing on our part, since we seen the issue by just placing a scriptmanager and toolkit controls on a page and watch the memory get chewed up.

    This seems like a glaring issue that has not been given enough focus.  Especially since IE is the biggest culprit and it's Microsoft AJAX technology causing these issues. 

    Can anyone respond to this issue?  This seems obvious and glaring.  Create a new AJAX web project, add a scriptmanager to the page and refresh, then watch the memory creep.  I do notice that the memory is re-couped when IE is minimized.  This doesn't help when a client keeps their browser open all the time, which is more common place these days.

     
    My client is on XP w/ IE7 and FF2.  Both browsers are afflicted by this issue but IE is even worse.

     Please help.
     

  • Re: Memory leak

    03-26-2008, 2:09 PM
    • Loading...
    • kirchi
    • Joined on 03-07-2007, 2:47 AM
    • Posts 328

    Hi FredK,

    I had the problems with memory leaks recently.

    I found that some add - ins installed in browser where affecting this.

    Cpesifically google toolbar and developer toolbar.

    after uninstalling them, everything was OK.

    My blog: http://blog.devarchive.net
    My samples: http://devarchive.net
Page 1 of 1 (9 items)
Microsoft Communities
Page view counter