function fetchXmlDoc(uri) { var xhr = new XMLHttpRequest(); var async = false; xhr.open("GET", uri, async); xhr.send(); return xhr.responseXML; }
Basically, when I call this function, does the xhr object get garbage collection, or will it stick forever because the caller is held on xhr.responseXML ? If this is the last, would it allow it?
function fetchXmlDoc2(uri) { var xhr = new XMLHttpRequest(); var async = false; xhr.open("GET", uri, async); xhr.send(); var xml = xhr.responseXML; return xml; }
Despite all my years of JS, all memory management still scares me ...
Domenic
source share