javascript - Memory impact of assigning a new value to global variable -


what happens when global variables reassigned new values - old memory safely released or leaked?

for example,

gui = {};  function myfunc1() {    gui.selecteditem = new bigarray(1000); } function myfunc2() {    gui.selecteditem = new bigarray(1000); } function release() {    gui.selecteditem = null; } 

would safe call myfunc1() , myfunc2() 1 after other immediately, or assign variable null first (before reassigning large object)?

i purely interested in memory pressure , concerned variable leaking old memory when new value assigned new.

javascript uses garbage collector reclaim memory of objects not accessible variables. old memory released automatically.


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -