Comment by micahherstand:

If I have classes in Java that reference each other, is this considered  
circular referencing and therefore will they never be GC'd?  I'm having  
big-time memory leaks in FF and Safari without JSNI.

Very stripped down example:

{{{
class Controller{
   Model m;
   View v;
   Controller(Model m, View v){
     this.m = m;
     this.v = v;
   }
   //...
}

class View{
   Model m;
   Controller c;
   View(Model m){
     this.m = m;
   }
   setController(Controller c)[
     this.c = c;
   }
   //...
}

class Run{
   onModuleLoad(){
     Model m = new Model();
     View v = new View(m);
     Controller c = new Controller(m,v);
     v.setController(c);
     m = null;
     v = null;
     c = null //Do Controller and View still exist after this line, since  
they reference each other?
   }
}
}}}


For more information:
http://code.google.com/p/google-web-toolkit/wiki/DomEventsAndMemoryLeaks

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to