Hey Jeff,

I did this in an app I built early last year.

Basically its like a tearDown in a unit test.

The trick is it has to work top down.
You have to reset child module model data,
prior to resetting parent module model data,
prior to shell model date.
That way hopefully your views are refreshed.

That app was cairngorm and used modules.
it also helps to remove the CairngormEventDispatcher singleton.

Basically we never unloaded.
We just made sure the data was fresh.

Even with the profiler it is near impossible to keep track of all your 
references, even without Cairngorm.


Bjorn


--- In flexcoders@yahoogroups.com, "Battershall, Jeff" <jeff.battersh...@...> 
wrote:
>
> Bjorn,
> 
> It's not ignorant if it is true.  And it seems like retro-fitting
> Cairngorm to support modules is a "work in progress".  
> 
> I came across a blog posting where Alistair spoke of better support for
> modules in Cairngorm in the future, but it looks like there's been no
> published evolution of Cairngorm in a couple of years.  Meanwhile
> PureMVC seems to have leapfrogged Cairngorm in this department.
> Unfortunately, I don't think migrating my app to PureMVC is an option at
> this point.
> 
> So the question becomes whether it is "worth it".  My app is currently
> built to unload modules when the user logs out.  The concept is that
> when someone logs in, in a particular app instance, they will get a
> completely fresh data model, fresh set of modules based on their
> profile, etc. The quick and dirty solution is to close down the instance
> on logout.  That would be expeditious, but it bugs me that I'd have to
> do that.
> 
> Jeff
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of Bjorn Schultheiss
> Sent: Tuesday, March 24, 2009 7:50 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Modules, Cairngorm and Garbage Collection
> 
> 
> Here's my ignorant statement for the week.
> 
> Having a module that is built using Cairngorm unload cleanly is not
> worth the effort required to make it work.
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, claudiu ursica <the_braniak@>
> wrote:
> >
> > I'm loading module via a command, so that it can be loaded form 
> > various places... So far I have used a Module Loader... And I use 
> > interfaces foe communicating with the modules and the shell. I don't 
> > know how you work with module but you can inject your pieces of data 
> > from the mx:app in the loader and into module when the as soon as the 
> > ready event fires. U can also use BindingUtils to set bindings which 
> > in turn returns a change watcher. use that to call unwatch upon when 
> > module unloads and so you make sure you performed celanup and 
> > unbinding before unload ...
> > 
> > Claudiu
> > 
> > 
> > 
> > 
> > ________________________________
> > From: "Battershall, Jeff" <jeff.battershall@>
> > To: flexcoders@yahoogroups.com
> > Sent: Tuesday, March 24, 2009 10:47:22 PM
> > Subject: RE: [flexcoders] Modules, Cairngorm and Garbage Collection
> > 
> > 
> > Thanks
> > Pedro,
> >  
> > As I
> > said in my previous post, I'm also wondering about the effect of a
> module's 
> > component consuming a dataprovider via binding to a singleton object
> and 
> > the possibility of that preventing GC.  I guess this touches on the
> whole 
> > issue of best practices of using ModelLocator with modules.  PureMVC
> has 
> > it's 'Pipes' utility to inject data objects into a module, but I'm
> using 
> > Cairngorm and I'm wondering how something similar could be achieved
> with that 
> > framework. 
> >  
> > Jeff
> > -----Original Message-----
> > From: flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. 
> > com] On Behalf Of Pedro Sena
> > Sent: Tuesday, March 24, 2009 3:06 PM
> > To: flexcod...@yahoogro ups.com
> > Subject: Re: [flexcoders] Modules,  Cairngorm and Garbage Collection
> > 
> > The GC is not called when  the component is remove from the screen.
> > 
> > Most people think this occurs,  but it's not truth.
> > 
> > The GC is called when its required, but WHEN it is  required is 
> > another point.
> > 
> > If you are using just a small piece of your  available mamory, don't 
> > expect the GC to be  called.
> > 
> > Regards,
> > 
> > PS
> > 
> > 
> > On Tue, Mar 24, 2009 at 2:09 PM, claudiu ursica <the_braniak@ 
> > yahoo.com> wrote:
> > 
> > Hi, why do you bind module to the model locator?
> > 
> > If by any  chance you have embedded CSS in the module it won't garbage
> 
> > collect  ...
> > 
> > Claudiu
> > 
> > 
> > 
> > 
> > ________________________________
> >  From: "Battershall, Jeff"  <jeff.battershall@ dowjones. com>
> > To: flexcod...@yahoogro ups.com
> > Sent: Tuesday, March 24, 2009 5:37:58  PM
> > Subject: [flexcoders]  Modules, Cairngorm and Garbage Collection
> >  
> > 
> > 
> > I've been working on optimizing an AIR application I'm currently  
> > working on that utilizes modules. In the modules there are controls 
> > bound  to ModelLocator data items.
> > 
> > What I'm seeing during profiling that  removing a module from the 
> > display list doesn't seem to result in the  module being GC'ed. I'm 
> > suspecting binding between the ModelLocator and  the module's controls
> 
> > are causing the behavior.
> > 
> > Has anyone seen  this and can suggest approaches to address this?
> > 
> > Jeff  Battershall
> > Application Architect
> > Dow Jones Indexes
> > jeff.battershall@ dowjones. com
> > (609) 520-5637  (p)
> > (484) 477-9900 (c)
> > 
> > 
> > 
> > 
> > --
> > /**
> > * Pedro Sena
> > * Systems Architect
> > * Sun Certified Java  Programmer 
> > * Sun Certified Web Component Developer
> > */
> >
> 
> 
> 
> 
> ------------------------------------
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-
> 1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>


Reply via email to