date.js cause memory leak

View: New views
2 Messages — Rating Filter:   Alert me  

date.js cause memory leak

by Julian Tree :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have included the following lib http://www.datejs.com

It works great, except for when I change some code and reload a web page, then Rhino or Helma instance just keeps on running until it times out.  It takes up 180% cpu on my MacBook.  The code runs fine as long as I don't change thing, but as you guys can see this will not work.

Is this a bug in Rhino, Helma or something to do with date.js.  I know that that lib is stil in alpha and it is mostly for clientside, but one thing I like about helma is that I will be able to use clientside js lib on serverside as well.  Please let me know if there are any work around. Thanks.

Julian

_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: date.js cause memory leak

by Rainer Rynesch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We had the same problem, it's because datejs overwrites the toString() method (causing an infinte loop when done twice) of the javascript Date prototype, as soon as you put the datejs within a condition there is no problem in chaning code (but you can't change date.js)

if(!global.dateloaded){
  global.dateloaded = true;
... Date.js code ...
}


 
Rainer
 

> -----Ursprüngliche Nachricht-----
> Von: helma-user-bounces@...
> [mailto:helma-user-bounces@...] Im Auftrag von Julian Tree
> Gesendet: Mittwoch, 01. Oktober 2008 06:34
> An: Helma User Mailing List
> Betreff: [Helma-user] date.js cause memory leak
>
> Hi,
>
> I have included the following lib http://www.datejs.com
>
> It works great, except for when I change some code and reload
> a web page, then Rhino or Helma instance just keeps on
> running until it times out.  It takes up 180% cpu on my
> MacBook.  The code runs fine as long as I don't change thing,
> but as you guys can see this will not work.
>
> Is this a bug in Rhino, Helma or something to do with
> date.js.  I know that that lib is stil in alpha and it is
> mostly for clientside, but one thing I like about helma is
> that I will be able to use clientside js lib on serverside as
> well.  Please let me know if there are any work around. Thanks.
>
> Julian
>
>
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user