Home > front end >  JS new Function of memory how to release
JS new Function of memory how to release

Time:04-19

 & lt; The script type="text/javascript" & gt; 
Var test="{var temp='test'; Enclosing testTemp='321', enclosing testFun=function () {return enclosing testTemp + temp; };" +
"Return temp." +
"} ";


The function newFunction () {
Var fun=new Function (test);
Var testCall=new fun ();
TestCall=null;
Fun=null;
}
</script>


Code in the function each time, the memory will exist an anonymous function String cannot be freed, this please and see whether this part by what way can release the memory, or alternative solutions,

  • Related