Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
what happens if I create timers using setInterval() repeatedly
for eg look at this code
for (var i=0;i<2000;i++)
here timers are created repeatedly but never cleared using clerInterval().
My question is will the code like this will effect the systems performance where this script is running??
Actually my application has a java script function which reloads a java servlet in a hidden frame. And this refresh should happen say after every 30 seconds. So I started a timer using setInterval.
But CPU utilization is continously showing 100%. When I looked at the code hoping to find out the problem, i found a pattern some thing like this in my code::
//some other code here
//refresh hidde frame here using location.replace()
if (some condition)
bcoz of this page is being refreshed but number of timers are created. Will this cause problem of "CPU utilization"??
Any knd of help regarding this issue will be appreciated