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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:52:04+00:00 2026-06-09T12:52:04+00:00

I’m using the chrome dev tools to work out if there is a memory

  • 0

I’m using the chrome dev tools to work out if there is a memory leak in some JS code. The memory timeline looks good with memory being reclaimed as expected.

enter image description here

However, the memory snapshot is confusing because it appears like there is a leak because there are entries under “Detached DOM Tree”.

Is the stuff under “Detached DOM Tree” just waiting to be garbage collected or are these real leaks?

Also does anyone know how to find out what function is holding on to a reference to a detached element?

enter image description here

  • 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-09T12:52:06+00:00Added an answer on June 9, 2026 at 12:52 pm

    Those elements are being referenced in your code but they are disconnected from the page’s main DOM tree.

    Simple example:

    var a = document.createElement("div");
    

    a references a disconnected element now, it cannot be GC’d when a is still in scope.

    If the detached dom trees persist in memory then you are keeping references to them. It is somewhat easy with jQuery to do this,
    just save a reference to a traversed result and keep that around. For example:

    var parents = $("span").parent("div");
    $("span").remove();
    

    Now the spans are referenced even though it doesn’t appear you are referencing them anyhow. parents indirectly keeps references
    to all the spans through the jQuery .prevObject property. So doing parents.prevObject would give the object that references all the spans.

    See example here http://jsfiddle.net/C5xCR/6/. Even though it doesn’t directly appear that the spans would be referenced,
    they are in fact referenced by the parents global variable and you can see the 1000 spans in the Detached DOM tree never go away.

    Now here’s the same jsfiddle but with:

    delete parents.prevObject
    

    And you can see the spans are no longer in the detached dom tree, or anywhere for that matter. http://jsfiddle.net/C5xCR/7/

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

Sidebar

Related Questions

Early on I was doing some debugging and testing using the chrome dev tools(known
I'm debugging a javascript app (using Chrome dev tools), and I would like to
I started using Google Chrome dev tools, but sometimes the break points become inactive
I'm using chrome devtools network API and the following code but always the alert
Site in question: http://www.sedulity.tk/ Site using Chrome 19 dev: Site using IE9: as you
I can't figure out what is going on. I'm using Chrome to debug my
I have been using Google Chrome's dev tool kit (element inspection, stack trace, javascript
I've been seeing this error more and more lately. I'm using the Chrome dev-channel
I'm debugging my ASP.NET MVC 3 web app using Google Chrome Developer Tools, and
I want to notify an user using Chrome browser. I need something powerful like

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.