0

Microsoft のドキュメントW3C のドキュメントも、リークについて言及していません。

動的に作成された行で発生します。これは、ajax を介してテーブルが定期的に更新される 1 ページの Web アプリケーションがあり、最終的には iexplore がすべてのメモリを消費し、Windows が停止するため、私たちにとって問題です。

再現するには:

function process() {
  var row = document.createElement('tr');
  var cell = document.createElement('td');
  var text = document.createTextNode();
  
  // doesn't matter order of these lines:
  row.appendChild(cell);
  cell.appendChild(text);
  
  // this leaks on IE8/9:
  var x = row.cells;
  
  // this alternative doesn't:
  //var x = row.getElementsByTagName("td");
  
  setTimeout(process, 10);
}

process();

http://jsfiddle.net/5wzW2/1/ (jsfiddle サイトは IE8 では動作しないため、上記のコードを投稿します)。

タスク マネージャーで iexplore のメモリ使用量が 1 分ごとに約 1 MB 増加するのを確認します。FF18/Chrome24にはありません。

理由、またはそれについて最善を尽くす方法はありますか?

Microsoft のバグ報告ページが壊れているようです。私の回避策は、たとえばtablesorterプラグイン.cellsでに置き換えることです。.getElementsByTagName("td")

4

1 に答える 1