otnj2ee
10-03-2008, 06:41 PM
If I use:
function test(){...}
testInstance = new test();
This variable named testInstance will become a global scope variable.
Can I removed it later if I do not need it?
(I mean if I have:
testInstance1 = new test();
testInstance2 = new test();
...
testInstance10 = new test();
For whatever purpose I need in my app, a lot of variable like testInstanceX will be created at the global level. So it may take some memory. I wonder If I can remove them once I do not need them, so to free the memory.)
Thanks
Scott
(For a local variable such as
function test(){
var localVar;
}
Once it is out of the function scope, I believe the localVar will be automatically removed from the memory so I do not need to worry about it.
)
function test(){...}
testInstance = new test();
This variable named testInstance will become a global scope variable.
Can I removed it later if I do not need it?
(I mean if I have:
testInstance1 = new test();
testInstance2 = new test();
...
testInstance10 = new test();
For whatever purpose I need in my app, a lot of variable like testInstanceX will be created at the global level. So it may take some memory. I wonder If I can remove them once I do not need them, so to free the memory.)
Thanks
Scott
(For a local variable such as
function test(){
var localVar;
}
Once it is out of the function scope, I believe the localVar will be automatically removed from the memory so I do not need to worry about it.
)