If I do something like
// global scope
function stuff() {
// local scope
var a = new SomeHugeMemoryHog();
}
// a doesn't exist down here, but what happened to the memory from the "stuff" scope?
Will I create a memory leak if I don't set a = null
at the end of the stuff
scope? Or should I not worry about it? I'm asking this question with emphasis on creating DOM
objects (such as a canvas
) inside the scope of functions (which I don't use later at any time). I'm only using the canvas to grab vector dimensions.