My javascript is quite simple . It just keep calling ajax to download data and display it on my screen. I reuse those DOM element by updating data directly ( using jquery’s $(DIV).empty() function and then appendTo another content). However, after running overnight, my computer hang and seems like keep doing something.
I try to watch the memory consumption by some firefox addon. When running two hours, the memory may grows 200MB , but I am not sure if it’s only caused by my js or other reason.
I have some question about this issue.
1. is there any good way to monitor it (such as how much memory is used by specific web page , how much CPU resource is occupied , and how?)
2. is there any some kinda general way to design js web app to avoid such problem?
thanks, any comment is appreciated!
Certain versions of Firefox use reference counting as a garbage collection strategy. Reference counting is prone to cause memory leaks under certain circumstances.
From http://www.ibm.com/developerworks/web/library/wa-memleak/