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 6569345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:36:55+00:00 2026-05-25T14:36:55+00:00

The topic of memory leaks in JavaScript is not brought up often. However, I

  • 0

The topic of memory leaks in JavaScript is not brought up often. However, I stumbled upon this article, written in 2007. The authors state:

Internet Explorer and Mozilla Firefox are the two Web browsers most
commonly associated with memory leaks in JavaScript.

Should I still be worrying about JavaScript memory leaks in 2011? If so, what should I be careful about?

  • 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-05-25T14:36:56+00:00Added an answer on May 25, 2026 at 2:36 pm

    A good javascript developer would be aware of various design patterns that can lead to memory leaks and you’d avoid coding anything that could turn in to a leak in pretty much all the pages you code.

    For example, keeping a reference to any DOM object in a javascript variable will keep that DOM object alive in memory even if it’s long since been removed from the DOM and you intended for it to be freed.

    Practically speaking, leaks are only significant in some circumstances. Here’s where I specifically worry about them:

    1. Anything I’m doing repetitively on a timer, particularly if it can be left running for a long time. For example, if you have a slideshow that might just loop forever, you have to make absolutely sure that nothing in the slideshow is an accumulating leak of either JS or DOM objects.
    2. A web page that works like an app and the user may stay on the same page for a long time, interacting with the page, doing ajax calls, etc… For example a web mail app might be open and on the same actual browser document for a very long time doing lots and lots of user and server interactions.
    3. A web page that regularly creates and destroys lots of DOM elements like something that regularly uses ajax to fetch a bunch of new HTML.

    Places where I don’t really worry about leaks:

    1. A web page that doesn’t have a long running set of interactions the user can do.
    2. A web page that doesn’t stay on screen very long before some other page is loaded or this page is reloaded.

    Some of the key things I keep an eye out for.

    1. Any lasting JS variables or properties that contain references to DOM elements when DOM elements are being created/destroyed.
    2. Any properties of a DOM object that contain references to other DOM objects or references to JS objects that contain reference to other DOM objects (this can create circular references and cross references between JS/DOM that some older browsers have trouble freeing).
    3. Any large data structures that I load for temporary use. I make sure that no references to these large data structures are every kept around.
    4. Any data caches. Make sure nothing really large gets cached that you don’t want cached. Make sure all caches that get used repeatedly don’t accumulate forever and have some sort of aging mechanism to get rid of old objects.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've asked question about JavaScript memory and HTML5 LocalStorage limitations on smartphones , however
The topic generically says it all. Basically in a situation like this: boost::scoped_array<int> p(new
As topic suggested, how can I unit test a function that does not return
as topic, I am strange that why does the SDK not provide API to
This topic has been scratched once or twice, but I am still puzzled. And
This is slightly off topic of programming but still has to do with my
(Don't know if this is strictly on-topic, but I don't see any better Stack
I was searching about this topic and I found many ways to convert an
Hi I read a few post on this topic, lets say I want to
I know there are a lot of questions on this topic already, but it

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.