Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:28+00:00 2026-06-10T13:15:28+00:00

We have created an application using Dojo with an clock on the UI. But

  • 0

We have created an application using Dojo with an clock on the UI. But sometimes the application UI just hung-up there and the clock just stopped. Guessing the JS engine just stopped because the clock is driven by javascript code.

Not sure following code causes memory leak and then causes the hang-up issue. We are using recursively setTimeout invoke to implement the clock.

dojo.declare("xxx.xxx.HomepageHeader", [dijit._Widget, dijit._Templated],
{
widgetsInTemplate: true,
_time :'',
dateUtil: null,

// ....
// ....

prefix :function (value, p)
{
    return (value < 10) ? p + value : value;
},

updateTime :function ()
{
    var d = new Date();
    var _this = this;
    var t = [_this.prefix(d.getHours(), '0'), _this.prefix(d.getMinutes(), '0'), _this.prefix(d.getSeconds(), '0')].join(':');
    _this._time.innerHTML = t;
    _this.dateInfo.innerHTML = this.dateUtil.format(d, "yyyy/MM/dd") + " &nbsp;|&nbsp " + this.dateUtil.format(d, "EEE");
    window.setTimeout( function(){_this.updateTime();}, 100);
}

// ....
// ....
}

Noticed that within the class, the method updateTime used window.setTimeout to recursively invoke itself to update time text on the UI.

Is there any memory leak issue here? If the answer is no, is there any possible issue caused the hang up issue?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:15:29+00:00Added an answer on June 10, 2026 at 1:15 pm

    This isn’t really recursion because setTimeout() schedules the next call to updateTime() for some time in the future and then the current updateTime() actually completes. So, there is no build-up of the stack frame and thus it’s not really recursion. Also, I don’t see any reason for a memory leak here.

    The scheme you have should be OK and it used often, but you may want to do it less often than every 100ms just to leave more CPU cycles for other things going on the browser.

    If you see the clock stop, it is because the JS engine is stuck or looping, but it’s probably stuck in code somewhere else other than the actual clock code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a blog application using Ruby on Rails and have just added
I am new in Asp.net MVC.i have created mvc application using datasource but i
I have created an android application using eclipse, but when i run it, i
I have created a chat application using PHP, but it works only into my
I have created simple chat application using smack api.i can able to chat well.but
I have created iPad application which downloads images using web service. But my application
I have created a mac application using the WebView. But issue is that webView
I have created an application using Adobe Flex. I took all the files from
I have created a chat application using the Jabber Smack API. I'm successfully receiving
I have created a mobile application using kendo Mobile UI's trial version in asp.net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.