System freezes after running javascript over night

My javascript is pretty simple. It just keeps calling ajax to load the data and display it on my screen. I reuse this DOM element by updating the data directly (using the jquery $ (DIV) .empty () function and then appendTo other content). However, after starting up at night, my computer freezes and seems to continue to do something.

I am trying to monitor memory consumption with some firefox addon. When working after two hours, the memory can grow up to 200 MB, but I'm not sure if this is caused only by my js or other reasons.

I have a question about this issue. 1. Is there a good way to control it (for example, how much memory is used on a particular web page, how much CPU resources are used and how?) 2. Is there some kind of general way to develop js web application to avoid such a problem ?

thanks, any comment is appreciated!

+5
source share
3 answers

Some versions of Firefox use link counting as a garbage collection strategy. It is believed that reference counting is subject to memory leak under certain circumstances.

Internet Explorer Mozilla Firefox - -. JavaScript. - , DOM . Windows COM, Mozilla XPCOM . , JavaScript. JavaScript. , COM Firefox IE.

http://www.ibm.com/developerworks/web/library/wa-memleak/

+3

, , jQuery , ajax, jqXHR ( , ..). jQuery, . , javascript .

http://api.jquery.com/jQuery.ajax/

+2

You can use the Chrome History feature to track memory usage over time. This is part of the built-in tools for developers. I'm sure Firebug or another FF plugin will provide the same features.

0
source

All Articles