タグ

2005年12月5日のブックマーク (3件)

  • Leak Free Javascript Closures

    October 20, 2005 Javascript closures can be a powerful programming technique. Unfortunately in Internet Explorer they are a common source of memory leaks. Therefore I propose a method to create closures that don't leak memory. Problem First start with a short explanation of the problem I tried to fix. Here is an example of a simple event handler (IE only for clarity): function attach() {

    takef
    takef 2005/12/05
    クロージャを使うときにメモリリークを回避する方法
  • DOM オブジェクトとメモリリーク: Days on the Moon

    IE でのメモリリーク ちょこちょこと紹介されているので知っている人も多いと思うが、IE には DOM ノードに絡んだメモリリークの問題がある。これに関しては Microsoft 自身の記事である「Understanding and Solving Internet Explorer Leak Patterns」に詳しいが、簡単にいえば DOM ノードオブジェクトに関する循環参照を作ると、IE を終了させるまでそのオブジェクトが解放されないというものだ。記事によればメモリリークには以下のようなパターンがあるという。 1. 単純な循環参照 ある DOM ノードオブジェクトのプロパティをたどっていくと自分自身に行き着く場合。以下のようなパターンが考えられる。 element.property == element element1.property1 == element2, element2

    takef
    takef 2005/12/05
    循環参照を作ってしまうとメモリリークする。クロージャには注意。
  • 文字列連結のスピード - H.L.B. /* hyper@shのLog Book */

    via オレンジニュース StringBuilder と += による文字列連結の速度比較 @ Landscape - エンジニアのメモ 同じ事をJavaで試してみました。 環境は、 CPU : Pentium 4 1.70GHz RAM : 1024MB JVM : J2RE 1.5.0(ヒープサイズはデフォルト) +=演算子による連結、String#concat()メソッドによる連結(あまり一般的ではないと思いますが・・・)、定石のStringBufferクラス、さらにJ2SE 5.0で加わったStringBuilderクラスも試してみました。 ソースはこれ。J2SE 5.0以降対応です。5.0の新しいSystem.nanoTime()はこういうベンチマークで便利なんですが、DateFormat等で整形できないのがなんとも・・・。 public class StringConcaten

    文字列連結のスピード - H.L.B. /* hyper@shのLog Book */
    takef
    takef 2005/12/05