javascriptのクロージャでメモリリークが起こる場合があると思います。
javascript
1var hoge = function(){ 2 var x = 0; 3 process.on('exit', function(){ 4 x++; 5 }); 6 return function(){ 7 return x; 8 } 9} 10var h = hoge(); 11console.log(h()); 12console.log(h()); 13console.log(h());
varのつく変数はDontDelete属性がつくため、delete演算子で解放できませんが、上記の例でvarをつけずに、
javascript
1var hoge = function(){ 2 x = 0; 3 process.on('exit', function(){ 4 x++; 5 }); 6 return function(){ 7 return x; 8 } 9} 10var h = hoge(); 11delete x; 12console.log(h()); 13console.log(h()); 14console.log(h());
とするのはありですか?
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。