or Create a profile
06 Jun, 2012 03:07 PM
We recently discovered a GC issue with the Joel Hooks modular
extension, concerning the automatic instanciation of mediators.
1) Instanciate a module "A" and display a view "V"
2) Release the module A and instanciate a module "B"
3) Release the module B and reinstanciate the module A, and display
the view V
4) Issue is that two mediators are instanciated for the view V for
the last ADDED_TO_STAGE event
If, after the step 2, we force the garbage collection, there is
The reason is that, at step 3, the mediatorMap and viewMap of
the step 1 are still in memory, listening for the ADDED_TO_STAGE,
they are ready to be garbage collected but the GC only comes when
it wants, and on small modules its doesn't come at every module
change. So when the view V is added to stage, the event is received
by the mediatorMap and viewMap of the two modules : the old A and
the new A.
We did this fix :
1) Sub-class of MediatorMap with a public method dispose() that
2) Sub-class of ViewMap with a public method dispose() that calls
3) Sub-class of ModuleContext :
- The mediatorMap and viewMap getters returns our own maps. - The
dispose method call dispose() method of maps. 4) When a module is
released, we call its dispose() method.
Was it a known issue ?
2 Posted by Joel Hooks on 06 Jun, 2012 04:54 PM
Hey dada, I don't believe this is a known issue. Would you mind
creating a pull request with your fix? I'd love to check it out and
see about pulling it in.
You think it is something that could be recreated in a unit
3 Posted by dada on 07 Jun, 2012 02:29 PM
I did the pull request with the fixes in sub-classes.
I added 3 unit tests, 2 are GC dependant so maybe they can fail in
some conditions, but they "work on my machine" (TM). :-)
Tell me if you want more informations.
Ondina D.F. closed this discussion
on 27 Aug, 2012 10:38 AM.
Comments are currently closed for this discussion.
You can start a new one.
2 people watching.
No more actions from Robotlegs or the discussion starter are required.
This discussion is private.
Only you and Robotlegs support staff can see and reply to it.
This discussion is public. Everyone can see and reply to it.
Powered by Tender™.