Welcome Guest Search | Active Topics | Sign In | Register

Memory leakage with CallbackPanel Tabstrip and MultiPage Options
Jan Rygh
Posted: Friday, July 17, 2009 10:39:02 AM
Rank: Member
Groups: Member

Joined: 2/9/2009
Posts: 23
Hi, I have a Page with CallbackPanel, Tabstrip and Multipage.

It seems to consume mamory everytime I make a tabstrip.item visible (or do a postback. I have added some example code. Press "up tab 1" to start a fast loop or remove the ClientSideAfterUpdate script to test it maually.

I have the version 7.0.16.2 of EO.Web.dll

Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="TestNameSpace.Test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>

    <script type="text/javascript">
    // JScript File, agent chat javascripts used in AgentChat.aspx

function up() {

     eo_Callback('cpTab', 'UP');
}

function down() {

     eo_Callback('cpTab', 'DOWN');
}


function cpTabAfterUpdate(cb, extraData)
{    
   if(extraData!=null && extraData.match("fromDown"))
   { 
     up();	  
   }
  else
  {
    down();
  }	
}
                     
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <a href="javascript:up();">up tab 1</a>
    <br />
    <a href="javascript:down();">down tab 1</a>
    <br />
    

            
            
        <eo:CallbackPanel ID="cpTab" runat="server" ClientSideAfterUpdate="cpTabAfterUpdate">
        <eo:TabStrip ID="TabStrip1" runat="server" Width="400px" MultiPageID="MultiPage1">
            <TopGroup>
                <Items>
                    <eo:TabItem Text-Html="tab0" Visible="true">
                    </eo:TabItem>
                    <eo:TabItem Text-Html="tab1" Visible="false">
                    </eo:TabItem>
                </Items>
            </TopGroup>
            <LookItems>
                <eo:TabItem ItemID="_Default" RightIcon-Url="00010223" RightIcon-SelectedUrl="00010226"
                    NormalStyle-CssText="color: #606060" SelectedStyle-CssText="color: #2f4761; font-weight: bold;"
                    LeftIcon-Url="00010221" LeftIcon-SelectedUrl="00010224" Image-Url="00010222"
                    Image-SelectedUrl="00010225" Image-Mode="TextBackground" Image-BackgroundRepeat="RepeatX">
                    <SubGroup Style-CssText="font-family: tahoma; font-size: 8pt; background-image: url(00010220); background-repeat: repeat-x; cursor: hand;"
                        OverlapDepth="8">
                    </SubGroup>
                </eo:TabItem>
            </LookItems>
        </eo:TabStrip>
    </eo:CallbackPanel>
    <eo:MultiPage runat="server" ID="MultiPage1">
        <eo:PageView ID="PageView0" runat="server">
            pageview 0

        </eo:PageView>
        <eo:PageView ID="PageView1" runat="server">
            pageview 1
            <eo:Editor ID="Editor1" runat="server" BackColor="White" Width="360" Height="110"
                HtmlBodyCssClass="editor_body">
                <HeaderStyle CssText="height:1px;border-top-style:solid;border-top-width:1px;border-top-color:#E0E0E0" />
                <CustomHeaderTemplate>
                </CustomHeaderTemplate>
            </eo:Editor>
        </eo:PageView>
    </eo:MultiPage>            
 
    </form>
</body>
</html>


Code behind:

Code: C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.Drawing;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;

using EO.Web;


namespace TestNameSpace
{
    public partial class Test : System.Web.UI.Page
    {

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            this.cpTab.Execute += new EO.Web.CallbackEventHandler(this.cpTab_Execute);

        }
        #endregion
        private void cpTab_Execute(object sender, EO.Web.CallbackEventArgs e)
        {

            switch (e.Parameter)
            {
                case "UP":
                    TabStrip1.Items[1].Visible = true;;
                    TabStrip1.SelectedIndex = 1;

                    break;
                case "DOWN":
                    // remove tab
                    TabStrip1.SelectedIndex = 0;
                    TabStrip1.Items[1].Visible = false;
                    e.Data = "fromDown";
                    break;
                default:
                    break;
            }



        }

    }
}
eo_support
Posted: Friday, July 17, 2009 11:04:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Thank you very much for the test code. We will look into it and see what we can find.

Thanks
Jan Rygh
Posted: Friday, July 31, 2009 4:40:25 AM
Rank: Member
Groups: Member

Joined: 2/9/2009
Posts: 23
Some additional strange behavior.

If I try to increment the javascript variable i in my javascript, it seems to be initialized on every callback. I would expect it to increase. I have added som code to the previous posting. The code behind page is the same.


Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test4.aspx.cs" Inherits="TestNameSpace.Test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>

    <script type="text/javascript">
    // JScript File, agent chat javascripts used in AgentChat.aspx
var i=0;
var increment;
function startTab() {
 increment=true;
 up();

}
function stop() {
 increment=false;   
}
function up() {
     eo_Callback('cpTab', 'UP');
}
function down() {
     eo_Callback('cpTab', 'DOWN');
}

function writeDisplay(calledFrom) {
    i++;
    var display = document.getElementById("display");
    if(display)
        display.innerHTML = "Function called from: " + calledFrom + " Value of i: " + i + "<br>";  
    display=null;
}

function cpTabAfterUpdate(cb, extraData)
{    
  writeDisplay(extraData);
  if(increment)
  {
       if(extraData!=null && extraData.match("fromDown"))
       {            
         up();	  
       }   
      else if(extraData!=null && extraData.match("fromUp"))
      {
        down();
      }
  } 	
}                    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <a href="javascript:startTab();">startTab</a>
    <br />
    <a href="javascript:stop();">stop</a>
    <br />   
    <div id="display">Not incremented</div>           
    <eo:CallbackPanel ID="cpTab" runat="server" ClientSideAfterUpdate="cpTabAfterUpdate">           
        <eo:TabStrip ID="TabStrip1" runat="server" Width="400px" MultiPageID="MultiPage1">
            <TopGroup>
                <Items>
                    <eo:TabItem Text-Html="tab0" Visible="true">
                    </eo:TabItem>
                    <eo:TabItem Text-Html="tab1" Visible="false">
                    </eo:TabItem>
                </Items>
            </TopGroup>
            <LookItems>
                <eo:TabItem ItemID="_Default" RightIcon-Url="00010223" RightIcon-SelectedUrl="00010226"
                    NormalStyle-CssText="color: #606060" SelectedStyle-CssText="color: #2f4761; font-weight: bold;"
                    LeftIcon-Url="00010221" LeftIcon-SelectedUrl="00010224" Image-Url="00010222"
                    Image-SelectedUrl="00010225" Image-Mode="TextBackground" Image-BackgroundRepeat="RepeatX">
                    <SubGroup Style-CssText="font-family: tahoma; font-size: 8pt; background-image: url(00010220); background-repeat: repeat-x; cursor: hand;"
                        OverlapDepth="8">
                    </SubGroup>
                </eo:TabItem>
            </LookItems>
        </eo:TabStrip>
    </eo:CallbackPanel>
    <eo:MultiPage runat="server" ID="MultiPage1">
        <eo:PageView ID="PageView0" runat="server">
            pageview 0

        </eo:PageView>
        <eo:PageView ID="PageView1" runat="server">
            pageview 1

        </eo:PageView>
    </eo:MultiPage>            
    </form>
</body>
</html>
eo_support
Posted: Friday, July 31, 2009 9:11:29 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Try to use a more unique variable name rather than "i". I believe "i" was used in our script somewhere without being correctly declared (which is a problem needs to be addressed) and overwrote your "i" value. Your initialization script did not get called again.

Thanks!
Jan Rygh
Posted: Monday, August 17, 2009 11:17:43 AM
Rank: Member
Groups: Member

Joined: 2/9/2009
Posts: 23
Have you looked into the code. Can you confirm that there are a memory leakage when you add a tabstrip inside a callback panel? Any fix or workaround?

If you don't, I have to start rewrite my code because the webapplication makes webbrowsers halt do to wast memory consumption after a while.
Texwinca Developer
Posted: Monday, August 17, 2009 11:00:23 PM
Rank: Advanced Member
Groups: Member

Joined: 3/31/2009
Posts: 52
This issue I also worried about it. If you have any updated, please also notice me. Thanks a lot!
eo_support
Posted: Tuesday, August 18, 2009 7:27:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We are aware of this but have not been able to make any progress on this yet. The problem is much more obvious when an Editor is used. However it can also occur without the Editor. Since there is way to precisely control browser memory usage, so a reliable solution seems to be difficult. We will reply again if we have an update.

Thanks!
Jan Rygh
Posted: Friday, August 21, 2009 8:00:04 AM
Rank: Member
Groups: Member

Joined: 2/9/2009
Posts: 23
I have tested a bit more to try to isolate the problem and found two different leakages. As you say, the editor is a problem by it self. I tried with both a Internet Eplorer browser (IE8) and Opera browser

Scenario 1: callbackpanel with an editor on the page gives memory leakage in both Opera and IE
Scenario 2: callbackpanel with a tabstrip inside gives memory leakage only in IE, not in Opera. It indicates a circular reference problem that result in memory leakage in IE, see http://msdn.microsoft.com/en-us/library/bb250448(VS.85).aspx
Scenario 3: callbackpanel with a tabstrip outside the callbackpanel gives no memory leakage as far as I can see


Here is the code for the three scenarios:

Scenario 1:

Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test8.aspx.cs" Inherits="TestNameSpace.Test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>

<script type="text/javascript">
var myi=0;
var increment;

function startIncr() {
 increment=true;
 incr();
}

function stop() {
 increment=false;
}

function incr() {
     eo_Callback('cpTab', 'INCR');
      writeDisplay();	
     if(increment){	setTimeout('incr()',200); }
}

function writeDisplay() {
    myi++;
    var display = document.getElementById("display");
    if(display)
        display.innerHTML = "Value of i: " + myi + "<br>";  
    display=null;
}                   
</script>

</head>
<body>
    <form id="form1" runat="server">
    <a href="javascript:stop();">stop</a>
    <br />
     <a href="javascript:startIncr();">startIncrement i</a>
    <br />
    <div id="display">Not incremented</div>        
    <eo:CallbackPanel ID="cpTab" runat="server" >            
    </eo:CallbackPanel>
    <eo:Editor ID="Editor" runat="server" BackColor="White" Width="360" Height="110"
        HtmlBodyCssClass="editor_body">
        <HeaderStyle CssText="height:1px;border-top-style:solid;border-top-width:1px;border-top-color:#E0E0E0" />
        <CustomHeaderTemplate>
        </CustomHeaderTemplate>
    </eo:Editor>          
    </form>
</body>
</html>


No codebehind

Scenario 2 (tabstrip inside callbackpanel):
Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test7.aspx.cs" Inherits="TestNameSpace.Test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>

<script type="text/javascript">
var myi=0;
var increment;

function startIncr() {
 increment=true;
 incr();
}

function stop() {
 increment=false;
}

function incr() {
     eo_Callback('cpTab', 'INCR');
      writeDisplay();

     if(increment){	setTimeout('incr()',200); }
}

function writeDisplay() {
    myi++;
    var display = document.getElementById("display");
    if(display)
        display.innerHTML = "Value of i: " + myi + "<br>";  
    display=null;
}                   
</script>

</head>
<body>
    <form id="form1" runat="server">
    <a href="javascript:stop();">stop</a>
    <br />
     <a href="javascript:startIncr();">startIncrement i</a>
    <br />
    <div id="display">Not incremented</div>        
    <eo:CallbackPanel ID="cpTab" runat="server" >            
    
    
        <eo:TabStrip ID="TabStrip1" runat="server" Width="400px" MultiPageID="MultiPage1">
            <TopGroup>
                <Items>
                    <eo:TabItem Text-Html="tab0" Visible="true">
                    </eo:TabItem>
                    <eo:TabItem Text-Html="tab1" Visible="true">
                    </eo:TabItem>
                </Items>
            </TopGroup>
            <LookItems>
                <eo:TabItem ItemID="_Default" RightIcon-Url="00010223" RightIcon-SelectedUrl="00010226"
                    NormalStyle-CssText="color: #606060" SelectedStyle-CssText="color: #2f4761; font-weight: bold;"
                    LeftIcon-Url="00010221" LeftIcon-SelectedUrl="00010224" Image-Url="00010222"
                    Image-SelectedUrl="00010225" Image-Mode="TextBackground" Image-BackgroundRepeat="RepeatX">
                    <SubGroup Style-CssText="font-family: tahoma; font-size: 8pt; background-image: url(00010220); background-repeat: repeat-x; cursor: hand;"
                        OverlapDepth="8">
                    </SubGroup>
                </eo:TabItem>
            </LookItems>
        </eo:TabStrip>
    </eo:CallbackPanel>
           <eo:MultiPage runat="server" ID="MultiPage1">
        <eo:PageView ID="PageView0" runat="server">
            pageview 0

        </eo:PageView>
        <eo:PageView ID="PageView1" runat="server">
            pageview 1

        </eo:PageView>
    </eo:MultiPage>          
    </form>
</body>
</html>


Code behind in Test7.aspx.cs
Code: C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.Drawing;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;

using EO.Web;


namespace TestNameSpace
{
    public partial class Test : System.Web.UI.Page
    {

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            this.cpTab.Execute += new EO.Web.CallbackEventHandler(this.cpTab_Execute);

        }
        #endregion
        private void cpTab_Execute(object sender, EO.Web.CallbackEventArgs e)
        {
            if(TabStrip1.Items[1].Visible == true)
                TabStrip1.Items[1].Visible = false;
            else
                TabStrip1.Items[1].Visible = true;


        }

    }
}


Scenario 3 (tabstrip outside the callbackpanel ):
Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="TestNameSpace.Test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>

<script type="text/javascript">
var myi=0;
var increment;
var isTab1Visible = true; 

function startIncr() {
 increment=true;
 incr();
}

function stop() {
 increment=false;
}

function incr() {
     eo_Callback('cpTab', 'INCR');
      writeDisplay();
      if(isTab1Visible)
      {
        isTab1Visible = false;
      }
      else
      {
         isTab1Visible = true;
      }	
     TabStrip1.getTopGroup().getItemByIndex(1).setVisible(isTab1Visible);

     if(increment){	setTimeout('incr()',200); }
}

function writeDisplay() {
    myi++;
    var display = document.getElementById("display");
    if(display)
        display.innerHTML = "Value of i: " + myi + "<br>";  
    display=null;
}                   
</script>

</head>
<body>
    <form id="form1" runat="server">
    <a href="javascript:stop();">stop</a>
    <br />
     <a href="javascript:startIncr();">startIncrement i</a>
    <br />
    <div id="display">Not incremented</div>        
    <eo:CallbackPanel ID="cpTab" runat="server" >            
    </eo:CallbackPanel>
    
    
        <eo:TabStrip ID="TabStrip1" runat="server" Width="400px" MultiPageID="MultiPage1">
            <TopGroup>
                <Items>
                    <eo:TabItem Text-Html="tab0" Visible="true">
                    </eo:TabItem>
                    <eo:TabItem Text-Html="tab1" Visible="true">
                    </eo:TabItem>
                </Items>
            </TopGroup>
            <LookItems>
                <eo:TabItem ItemID="_Default" RightIcon-Url="00010223" RightIcon-SelectedUrl="00010226"
                    NormalStyle-CssText="color: #606060" SelectedStyle-CssText="color: #2f4761; font-weight: bold;"
                    LeftIcon-Url="00010221" LeftIcon-SelectedUrl="00010224" Image-Url="00010222"
                    Image-SelectedUrl="00010225" Image-Mode="TextBackground" Image-BackgroundRepeat="RepeatX">
                    <SubGroup Style-CssText="font-family: tahoma; font-size: 8pt; background-image: url(00010220); background-repeat: repeat-x; cursor: hand;"
                        OverlapDepth="8">
                    </SubGroup>
                </eo:TabItem>
            </LookItems>
        </eo:TabStrip>
           <eo:MultiPage runat="server" ID="MultiPage1">
        <eo:PageView ID="PageView0" runat="server">
            pageview 0

        </eo:PageView>
        <eo:PageView ID="PageView1" runat="server">
            pageview 1

        </eo:PageView>
    </eo:MultiPage>          
    </form>
</body>
</html>


No code behind
eo_support
Posted: Friday, August 21, 2009 8:07:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Thank you very much for the additional information. We are aware of the circular reference issue but we have not been able to nail it down yet. In fact our code always explicitly breaks circular reference. So please bear with us while we are still researching the issue.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.