PRODUKTE| ORGANISATION| WIEDERVERKAUF| ENTWICKLUNG| KONTAKT  
 
   
 
 
PRODUKTE
 Content Management
 Intranet/Extranet
 Framework
 
ORGANISATION
 Referenzen
 Kunden
 Case Studys
 
WIEDERVERKAUF
 Überblick
 Noch heute Starten
 
ENTWICKLUNG
 Screenshots
 1. Memory Leak in IE 6/7
 2. Links
 3. DOM - JS Engine
 4. Example Table
 5. Closures
 6. DOM insertion
 7. innerHTML !!!
 8. DWR / ajaxCFC
 
KONTAKT
 Kontaktformular

  
Closures

Closures do not create leaks as default. Only closure functions having dom references that are not properly cleaned up will leak.

There are some good references about closures. See the Link "Closures for dummies" that says:

"a closure is the local variables for a function - kept alive after the function has returned"
 
OR

"In JavaScript, if you use the function keyword inside another function, you are creating a closure."

LEAK Problems with closures occur ONLY in conjunction with circular references (JS > DOM > JS).

function test(){
 var localVaribale....;
 var x = new function(){ modify localVaribale}
}

The easiest way to prevent "closure leaks" is to move the "inner function" outside of the main function. Then you have to care only about any circular references. If you are an experiance programmer, you may use closures and remove any circular references without any problem.


function test(){
 var localVaribale....;
 ModifyMe(localVaribale);
}
 
function ModifyMe(myVar){
 Modify myVar;
}

     
     
KONTAKT
 
Adresse
    posOS GmbH
Thundorferstrasse 31
8500 FrauenfelD
     
 
Kontakt
    phone: +41(0)794145464
Email: info@posos.net
Anfragen: angebot@posos.net