[jQuery] Re: Memory problem

2007-04-22 Thread Michael Schwarz


Thanks for creating the ticket...

Michael


On 4/20/07, Brandon Aaron [EMAIL PROTECTED] wrote:


Michael,

I went ahead and created a ticket for this so that it doesn't get lost
in the archives.

http://dev.jquery.com/ticket/1136

--
Brandon Aaron

On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote:

 Hi,

 I added some lines to the remove function (line 1245):

 // original
 if(!k) element[on + type] = null;

 // changed to
 if (!k) {
 element[on + type] = null;

 for ( var i=0; ithis.global[type].length; i++) {
 if(this.global[type][i] == element) {
 this.global[type].splice(i, 1);
 break;
 }
 }
 }

 I see that the for loop isn't very well, maybe there is another way to
 remove the element if there is no handler.

 Michael



 On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote:
  Hi,
 
  I see the problem, now. The array jQuery.event.global is getting
  bigger and bigger. For a long running Web application (without any
  page refresh) it is a strange problem. If I have removed an event and
  then will delete the element (the DOM element) this should be removed
  from the jQuery.event.global array. If I press F5 it will clear nearly
  everything and memory usage is like before.
 
  Michael
 
 
 
  On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote:
   Sorry, I forgot to mention that I'm using Internet Explorer 6 on
   Windows XP. With other web browser I don't see any problem. The
   example above will grow with every re-render.
  
   Michael
  
  
  
   On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote:
Michael,
   
The example works for me - what's the problem?
   
rob.
   
   
On 4/19/07, Michael Schwarz [MVP]  [EMAIL PROTECTED] wrote:

 Hi,

 I have a very simple page which will be refreshed from time to time. I
 build an example which will be called every 1000 msec to redner a html
 table with a button inside. The button click event is set with the
 bind method. What I'm doing wrong?

 Regards,
 Michael



 div id=display
 /div

 script type=text/javascript

 function clickhandler() {
 alert(clicked);
 }

 function render() {
 var d = new Date();
 var n = d.getTime();

 $(button).unbind(click, clickhandler);

 var sb = [];
 sb.push(table);
 for(var i=0; i100; i++) {
 sb.push(trtd + i + /tdtd + n +
/tdtdbuttonClick/
 button/td/tr);
 }
  sb.push(/table);

 $(#display).html(sb.join(''));
 $(button).bind(click, clickhandler);

 setTimeout(render, 1000);
 }

 $(window).ready(render);

 /script


   
   
   
--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.
  
  
   --
   Best regards | Schöne Grüße
   Michael
  
   Microsoft MVP - Most Valuable Professional
   Microsoft MCAD - Certified Application Developer
  
   http://weblogs.asp.net/mschwarz/
   http://www.ajaxpro.info/
  
   Silverlight: http://groups.google.com/group/wpf-everywhere/
   Ajax.NET Professional: http://groups.google.com/group/ajaxpro/
  
   Skype: callto:schwarz-interactive
   MSN IM: [EMAIL PROTECTED]
  
 
 
  --
  Best regards | Schöne Grüße
  Michael
 
  Microsoft MVP - Most Valuable Professional
  Microsoft MCAD - Certified Application Developer
 
  http://weblogs.asp.net/mschwarz/
  http://www.ajaxpro.info/
 
  Silverlight: http://groups.google.com/group/wpf-everywhere/
  Ajax.NET Professional: http://groups.google.com/group/ajaxpro/
 
  Skype: callto:schwarz-interactive
  MSN IM: [EMAIL PROTECTED]
 


 --
 Best regards | Schöne Grüße
 Michael

 Microsoft MVP - Most Valuable Professional
 Microsoft MCAD - Certified Application Developer

 http://weblogs.asp.net/mschwarz/
 http://www.ajaxpro.info/

 Silverlight: http://groups.google.com/group/wpf-everywhere/
 Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

 Skype: callto:schwarz-interactive
 MSN IM: [EMAIL PROTECTED]





--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]


[jQuery] Re: Memory problem

2007-04-20 Thread Michael Schwarz


Hi,

I see the problem, now. The array jQuery.event.global is getting
bigger and bigger. For a long running Web application (without any
page refresh) it is a strange problem. If I have removed an event and
then will delete the element (the DOM element) this should be removed
from the jQuery.event.global array. If I press F5 it will clear nearly
everything and memory usage is like before.

Michael



On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote:

Sorry, I forgot to mention that I'm using Internet Explorer 6 on
Windows XP. With other web browser I don't see any problem. The
example above will grow with every re-render.

Michael



On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote:
 Michael,

 The example works for me - what's the problem?

 rob.


 On 4/19/07, Michael Schwarz [MVP]  [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I have a very simple page which will be refreshed from time to time. I
  build an example which will be called every 1000 msec to redner a html
  table with a button inside. The button click event is set with the
  bind method. What I'm doing wrong?
 
  Regards,
  Michael
 
 
 
  div id=display
  /div
 
  script type=text/javascript
 
  function clickhandler() {
  alert(clicked);
  }
 
  function render() {
  var d = new Date();
  var n = d.getTime();
 
  $(button).unbind(click, clickhandler);
 
  var sb = [];
  sb.push(table);
  for(var i=0; i100; i++) {
  sb.push(trtd + i + /tdtd + n +
 /tdtdbuttonClick/
  button/td/tr);
  }
   sb.push(/table);
 
  $(#display).html(sb.join(''));
  $(button).bind(click, clickhandler);
 
  setTimeout(render, 1000);
  }
 
  $(window).ready(render);
 
  /script
 
 



 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.


--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]




--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]


[jQuery] Re: Memory problem

2007-04-20 Thread Michael Schwarz


Hi,

I added some lines to the remove function (line 1245):

// original
if(!k) element[on + type] = null;

// changed to
if (!k) {
   element[on + type] = null;

   for ( var i=0; ithis.global[type].length; i++) {
   if(this.global[type][i] == element) {
   this.global[type].splice(i, 1);
   break;
   }
   }
}

I see that the for loop isn't very well, maybe there is another way to
remove the element if there is no handler.

Michael



On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote:

Hi,

I see the problem, now. The array jQuery.event.global is getting
bigger and bigger. For a long running Web application (without any
page refresh) it is a strange problem. If I have removed an event and
then will delete the element (the DOM element) this should be removed
from the jQuery.event.global array. If I press F5 it will clear nearly
everything and memory usage is like before.

Michael



On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote:
 Sorry, I forgot to mention that I'm using Internet Explorer 6 on
 Windows XP. With other web browser I don't see any problem. The
 example above will grow with every re-render.

 Michael



 On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote:
  Michael,
 
  The example works for me - what's the problem?
 
  rob.
 
 
  On 4/19/07, Michael Schwarz [MVP]  [EMAIL PROTECTED] wrote:
  
   Hi,
  
   I have a very simple page which will be refreshed from time to time. I
   build an example which will be called every 1000 msec to redner a html
   table with a button inside. The button click event is set with the
   bind method. What I'm doing wrong?
  
   Regards,
   Michael
  
  
  
   div id=display
   /div
  
   script type=text/javascript
  
   function clickhandler() {
   alert(clicked);
   }
  
   function render() {
   var d = new Date();
   var n = d.getTime();
  
   $(button).unbind(click, clickhandler);
  
   var sb = [];
   sb.push(table);
   for(var i=0; i100; i++) {
   sb.push(trtd + i + /tdtd + n +
  /tdtdbuttonClick/
   button/td/tr);
   }
sb.push(/table);
  
   $(#display).html(sb.join(''));
   $(button).bind(click, clickhandler);
  
   setTimeout(render, 1000);
   }
  
   $(window).ready(render);
  
   /script
  
  
 
 
 
  --
  Rob Desbois
  Eml: [EMAIL PROTECTED]
  Tel: 01452 760631
  Mob: 07946 705987
  There's a whale there's a whale there's a whale fish he cried, and the
  whale was in full view.
  ...Then ooh welcome. Ahhh. Ooh mug welcome.


 --
 Best regards | Schöne Grüße
 Michael

 Microsoft MVP - Most Valuable Professional
 Microsoft MCAD - Certified Application Developer

 http://weblogs.asp.net/mschwarz/
 http://www.ajaxpro.info/

 Silverlight: http://groups.google.com/group/wpf-everywhere/
 Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

 Skype: callto:schwarz-interactive
 MSN IM: [EMAIL PROTECTED]



--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]




--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]


[jQuery] Re: Memory problem

2007-04-20 Thread Brandon Aaron


Michael,

I went ahead and created a ticket for this so that it doesn't get lost
in the archives.

http://dev.jquery.com/ticket/1136

--
Brandon Aaron

On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote:


Hi,

I added some lines to the remove function (line 1245):

// original
if(!k) element[on + type] = null;

// changed to
if (!k) {
element[on + type] = null;

for ( var i=0; ithis.global[type].length; i++) {
if(this.global[type][i] == element) {
this.global[type].splice(i, 1);
break;
}
}
}

I see that the for loop isn't very well, maybe there is another way to
remove the element if there is no handler.

Michael



On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote:
 Hi,

 I see the problem, now. The array jQuery.event.global is getting
 bigger and bigger. For a long running Web application (without any
 page refresh) it is a strange problem. If I have removed an event and
 then will delete the element (the DOM element) this should be removed
 from the jQuery.event.global array. If I press F5 it will clear nearly
 everything and memory usage is like before.

 Michael



 On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote:
  Sorry, I forgot to mention that I'm using Internet Explorer 6 on
  Windows XP. With other web browser I don't see any problem. The
  example above will grow with every re-render.
 
  Michael
 
 
 
  On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote:
   Michael,
  
   The example works for me - what's the problem?
  
   rob.
  
  
   On 4/19/07, Michael Schwarz [MVP]  [EMAIL PROTECTED] wrote:
   
Hi,
   
I have a very simple page which will be refreshed from time to time. I
build an example which will be called every 1000 msec to redner a html
table with a button inside. The button click event is set with the
bind method. What I'm doing wrong?
   
Regards,
Michael
   
   
   
div id=display
/div
   
script type=text/javascript
   
function clickhandler() {
alert(clicked);
}
   
function render() {
var d = new Date();
var n = d.getTime();
   
$(button).unbind(click, clickhandler);
   
var sb = [];
sb.push(table);
for(var i=0; i100; i++) {
sb.push(trtd + i + /tdtd + n +
   /tdtdbuttonClick/
button/td/tr);
}
 sb.push(/table);
   
$(#display).html(sb.join(''));
$(button).bind(click, clickhandler);
   
setTimeout(render, 1000);
}
   
$(window).ready(render);
   
/script
   
   
  
  
  
   --
   Rob Desbois
   Eml: [EMAIL PROTECTED]
   Tel: 01452 760631
   Mob: 07946 705987
   There's a whale there's a whale there's a whale fish he cried, and the
   whale was in full view.
   ...Then ooh welcome. Ahhh. Ooh mug welcome.
 
 
  --
  Best regards | Schöne Grüße
  Michael
 
  Microsoft MVP - Most Valuable Professional
  Microsoft MCAD - Certified Application Developer
 
  http://weblogs.asp.net/mschwarz/
  http://www.ajaxpro.info/
 
  Silverlight: http://groups.google.com/group/wpf-everywhere/
  Ajax.NET Professional: http://groups.google.com/group/ajaxpro/
 
  Skype: callto:schwarz-interactive
  MSN IM: [EMAIL PROTECTED]
 


 --
 Best regards | Schöne Grüße
 Michael

 Microsoft MVP - Most Valuable Professional
 Microsoft MCAD - Certified Application Developer

 http://weblogs.asp.net/mschwarz/
 http://www.ajaxpro.info/

 Silverlight: http://groups.google.com/group/wpf-everywhere/
 Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

 Skype: callto:schwarz-interactive
 MSN IM: [EMAIL PROTECTED]



--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]



[jQuery] Re: Memory problem

2007-04-19 Thread Rob Desbois

Michael,

The example works for me - what's the problem?

rob.

On 4/19/07, Michael Schwarz [MVP] [EMAIL PROTECTED] wrote:



Hi,

I have a very simple page which will be refreshed from time to time. I
build an example which will be called every 1000 msec to redner a html
table with a button inside. The button click event is set with the
bind method. What I'm doing wrong?

Regards,
Michael



div id=display
/div

script type=text/javascript

function clickhandler() {
alert(clicked);
}

function render() {
var d = new Date();
var n = d.getTime();

$(button).unbind(click, clickhandler);

var sb = [];
sb.push(table);
for(var i=0; i100; i++) {
sb.push(trtd + i + /tdtd + n +
/tdtdbuttonClick/
button/td/tr);
}
sb.push(/table);

$(#display).html(sb.join(''));
$(button).bind(click, clickhandler);

setTimeout(render, 1000);
}

$(window).ready(render);

/script





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Memory problem

2007-04-19 Thread Michael Schwarz


Sorry, I forgot to mention that I'm using Internet Explorer 6 on
Windows XP. With other web browser I don't see any problem. The
example above will grow with every re-render.

Michael



On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote:

Michael,

The example works for me - what's the problem?

rob.


On 4/19/07, Michael Schwarz [MVP]  [EMAIL PROTECTED] wrote:

 Hi,

 I have a very simple page which will be refreshed from time to time. I
 build an example which will be called every 1000 msec to redner a html
 table with a button inside. The button click event is set with the
 bind method. What I'm doing wrong?

 Regards,
 Michael



 div id=display
 /div

 script type=text/javascript

 function clickhandler() {
 alert(clicked);
 }

 function render() {
 var d = new Date();
 var n = d.getTime();

 $(button).unbind(click, clickhandler);

 var sb = [];
 sb.push(table);
 for(var i=0; i100; i++) {
 sb.push(trtd + i + /tdtd + n +
/tdtdbuttonClick/
 button/td/tr);
 }
  sb.push(/table);

 $(#display).html(sb.join(''));
 $(button).bind(click, clickhandler);

 setTimeout(render, 1000);
 }

 $(window).ready(render);

 /script





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.



--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Silverlight: http://groups.google.com/group/wpf-everywhere/
Ajax.NET Professional: http://groups.google.com/group/ajaxpro/

Skype: callto:schwarz-interactive
MSN IM: [EMAIL PROTECTED]