Referencing global variables in local scopes
- by Jineesh
Hello,
I would like to know memory leak in the below mentioned code. Does JavaScript do automatic garbage collection.
var aGlobalObject = SomeGlobalObject;
function myFunction() {
var localVar = aGlobalObject;
}
Do I have to clear the memory as given below.
var aGlobalObject = SomeGlobalObject;
function myFunction() {
var localVar = aGlobalObject;
localVar = null;// or delete localVar
}
Thanks