Home › ELEKTOR FORUMS › DigiButler (April & May 2008) › Webpage consuming memory

ELEKTOR FORUMS

Please log in to post a reply or subscribe / unsubscribe to topics

Topic: Webpage consuming memory

Author Post

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 09-12-2008 14:06

When I let the webbrowser view the main Digibutler page for a longer period, the memory consumption goes far away after day or so. Yes, this is probably a bug in the webbrowser, but still it would be interesting to know what is causing it. On a home automation system, it wouldn't be unreasonable to have a page up in view for a longer time. And so it would be interesting to know what one should avoid when making Digibutler web pages.

Browser: Internet explorer 7 on Win XP

Edit: Consumption is about 100K on 10s, or 10K/sec

Edit2: Can somebody else confirm this, or is it just me having this problem?

Post edited by hakann on 09-12-2008 14:16

Post edited by hakann on 09-12-2008 14:16

Post edited by hakann on 09-12-2008 14:17

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 26-02-2009 13:06

Any news on this?

As I said, probably a bug in Internet explorer, but since it is very much used it wouldn't be unresonable to do a workaround in the web page.

obcd007

1 post

Popping In
Popping In

Read post 26-02-2009 17:33

I know it's not a solution, but have you tried with another webbrowser like Firefox? It could be interesting to know if that one has memory leaks as well. After all, the webpage in the freescale is not that complex. I would suspect the auto refresh of the page to be responsible, but it's just a wild guess.

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 26-02-2009 17:57

No, have not tried with Firefox. I don't have it installed on the PC:s running against the Digibutler.

Your probably right about the auto refresh! Or at least that's the reason why it continously looses memory. The leak itself could be anywhere in the page doing the auto refresh.

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 27-02-2009 13:53

No, doesn't look like Firefox is doing the same thing. Right now only a fast check, but seems stable.

Can somebody else confirm or deny this behaviour (with Explorer)?

Explorer 7 on WinXP Pro with all updates. Also same problem on Vista.

Post edited by hakann on 27-02-2009 13:54

Post edited by hakann on 27-02-2009 13:55

Tof81

43 posts

Occasional Visitor
Occasional Visitor

Read post 26-04-2009 23:57

Hello hakann,

Better a late answer than none...
I confirm : ie (6 on XP Pro in my case) lose memory. I have to restart the browser after few days.

Sorry not to have a solution...

Christophe

Post edited by Tof81 on 26-04-2009 23:59

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 28-04-2009 10:34

Thanx!

I had an intention to test wich parts of the page was the problem, but I've hade no time for that.

Tof81

43 posts

Occasional Visitor
Occasional Visitor

Read post 23-05-2009 19:33

Hi again hakann,

I might have found a workaround, in main.js file.

It seems that http_request object (XMLHttpRequest) is not properly deleted after request completion. This should be automatically done, but it is not the case (I've seen a similar issue in Microsoft TechNet site).
I added a http_request.abort() at the end of each onreadystatechange handler, to force IE to release object.

This seems to work, as my explorer's memory usage is now stable (22 Mb, 359 open handles after 2 or 3 hours, to be be compared with more than 350 Mb and 2000 handles before modification).

Here is how I corrected main.js source code :
1. add a new function
function memoryleak_cleanup(http_request)
{
if (http_request.readyState == 4)  // acknowledged
  {
    http_request.abort();
  }
}


2. call it on leaking handler (server_ansvers) :
function server_ansvers(http_request)
{
  if (http_request.readyState == 4)
  {
      if (http_request.status == 200)
     {
        process_data(http_request.responseText);
        ansvers=0;	
     }
     else
     {
        ansvers = 0;
     }
     memoryleak_cleanup(http_request);
  }
}


3. To make it better, fix also the light on/off button, by modifying button2 function:
http_request.onreadystatechange = function() ;
becomes
http_request.onreadystatechange = function() {
     memoryleak_cleanup(http_request);
};


In attachment, you'll find the modified file where all handlers are fixed.

I hope this will work for you too.
Best regards,
Christophe

Attachmentmain.js


Post edited by Tof81 on 23-05-2009 19:36

Post edited by Tof81 on 23-05-2009 19:40

Post edited by Tof81 on 23-05-2009 19:46

Please log in to post a reply or subscribe / unsubscribe to topics

Subscribe now

Subscribe to our free
E-weekly Newsletter!

Enter your Email address:

Follow Elektor

      

Act now!

Sponsored

FAQ

Before submitting questions, review our FAQ section!

Bestseller

Controller Area Network Projects

The aim of this book is to teach you the basic principles of CAN networks and in addition the development of microcontroller based projects using the CAN bus.

Package Deals

Elektor Bundles

Check our Package Deals and save money! Discounts up to 19% now available!

Price Slashed

Elektor OSPV

This Open Source People Vehicle is perfect for factory halls, warehouses, hospitals, colleges, schools etc.