View Full Version : Javscript Timers, Memory ?

sir pannels
12-07-2006, 12:46 PM
yo all,

Just a quick one, just wondering if javascript timers use memory or make the browser crunch CPU?

Lets say a page had a timer running that runs a really small script that prints a word to a page, every second.. and this timer was ran every day, all day long for 6 months without switching machine off...

what would happen?

cheers all,
Sir P :D

12-07-2006, 03:46 PM
I don't think it matters at all....but might depend on the browser you are using.

That is to say that if the browser is memory efficient, and there are no memory leaks....the memory used for the timer would obviously be part of the memory used by the browser. In other words, the browser is responsible for handling threads executed in the script...and should clean dead threads when necessary.

Therefore, one can assume that if the browser handles memory efficiently...it wouldn't matter if you are using a timer or not. However, if your code memory is inefficient (you have a while..or a for loop that never terminates)...then you will have problems with the memory.

hope that answers your question.


sir pannels
12-07-2006, 05:47 PM
it does indeed answer my question.

Many thanks to you