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

  • Home
  • SEARCH
  • 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 3853924
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:32:39+00:00 2026-05-19T17:32:39+00:00

I’ve been tracking down some memory leaks in a Javascript file I’ve been working

  • 0

I’ve been tracking down some memory leaks in a Javascript file I’ve been working with, and I’ve found one of the last reamining culprits. When I get the responseXML from an XMLHttpRequest, I don’t think the response ever gets deleted. I don’t know how to delete it, I tried removing the child nodes and then setting it to null (Hoping garbage collection would work) and I also tried using the delete key word. Neither of these things seemed to help. Below is some of the offending code (I omitted some timeout stuff that removes the request itself, but that is not what’s causing the memory leak).

var request = new XMLHttpRequest();
request.open("GET", url, true);
request.onreadystatechange = onReadyStateChange1;
request.send();
}

function onReadyStateChange1()
{
    if (4 == request.readyState)
    {
        if (request.status == 200)
        {
            request.responseXML;     //It leaks even if I just do this.
            //me.ParseData(request.responseXML);
            me.disconnected = 0;
        } else
        {
            me.disconnected += 1;
        }
        request.onreadystatechange = noop;    //noop is an empty function
        request = null;
        me = null;
    }
}

As you can see in the code, I don’t even call ParseData, I just put request.responseXML; and it still leaks. If I comment that line out as well, though, the leak is gone. Meaning the leak is not in the ParseData function or elsewhere, it is the responseXML. I believe it has to do with the tree structure of responseXML, the DOM tree is probably not being cleaned properly. If anyone could help me that would be great.

  • 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-19T17:32:40+00:00Added an answer on May 19, 2026 at 5:32 pm

    The responseXML that IE returns is actually MSXML DOM instead of MSHTML DOM, so that developers can use selectNodes and selectSingleNode functions. MSXML DOM has its own garbage collection mechanism, so that you’ll not notice memory free right after the DOM is out of scope. Therefore, I would say that this is probably not a true memory leak but a delay free.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
i want to parse a xhtml file and display in UITableView. what is the
I'm looking for suggestions for debugging... If you view this site in Firefox or
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.