tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/779-mediators-garbage-collection-issueRobotlegs: Discussion 2018-10-18T16:35:35Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-11T09:58:54Z2012-01-11T09:58:54ZMediators Garbage collection issue<div><p>Hi PJ,</p>
<p>mediatorMap.mapView(SomeView, SomeMediator, null, true,
true);<br>
The last two parameters autoCreate and autoRemove are boolean
switches that provide convenient automatic mediator management, by
default set to true.<br>
If you set autoRemove to false, the Mediator won’t be removed
after the View has been removed from the display list.<br>
Try this and tell if it solved your issue.</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-11T10:48:44Z2012-01-11T10:48:44ZMediators Garbage collection issue<div><p>Ondina,<br>
Thanks for your suggestion , I tried it but still there is no
success . I am still observing multiple mediators acting for single
view events.</p></div>PJtag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-11T10:54:31Z2012-01-11T10:54:31ZMediators Garbage collection issue<div><p>Could you attach a stripped out example exhibiting the issue or
paste some relevant code. I will take a look at it.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-11T13:37:47Z2012-01-11T13:37:47ZMediators Garbage collection issue<div><p>What’s happening in the onRegister() method of your
mediators? Can you show us at least that fragment of your code? Are
you doing more than just adding events listeners?</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-11T16:52:49Z2012-01-11T16:52:49ZMediators Garbage collection issue<div><p>I was in the middle of building a simple flex application using
states that I intended to let you see, but then I spotted
Shaun’s example : FlexyStates.fxp</p>
<p><a href=
"http://knowledge.robotlegs.org/discussions/questions/114-best-use-of-model-mediator-view-when-using-flex-4-states#comment_1772776">
http://knowledge.robotlegs.org/discussions/questions/114-best-use-o...</a></p>
<p>It may help you.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-13T16:45:57Z2012-01-13T16:45:59ZMediators Garbage collection issue<div><p>I got solution for it,<br>
I mediator i was applying listeners to uicomponents by
addEventListener . Rather than doing that i am now using
eventMap.mapListener to addlisteners to view children in mediators
and override method:</p>
<pre>
<code> override public function onRemove():void
{
eventMap.unmapListeners();
}</code>
</pre>
<p>This is working fine.Attaching sample App which illustrates the
diffrence</p></div>PJtag:robotlegs.tenderapp.com,2009-10-18:Comment/128216862012-01-13T16:52:39Z2012-01-13T16:52:39ZMediators Garbage collection issue<div><p>Hi PJ,</p>
<p>eventMap.unmapListeners is done by the mediator already, so you
don't need to override that function - just as long as you use
eventMap.mapListener to the view children, it'll get cleaned up
automatically.</p>
<p>I'm glad you fixed it,</p>
<p>Stray</p></div>Stray