>>>

I'm not sure that's true for Loader.unload() and event handlers..

>>>

I agree with Muzak.

The thing with event listeners is that you're adding a reference to the
subscriber in the dispatcher.

Think of this:

someDispatcher.addEventListener("someEvent",handler);

Like equivalent to this:

someDispatcher.subscriber = this;

Assuming the loaded swf "owns" (so to speak)  someDispatcher and there are
no references to it outside the loader, it should be cleaned up when the
loaded swf is disposed, because it's not reachable.

Some objects like Timers, on the other hand, should be explicitly stopped
and any handlers to it removed, but that's because (I assume) even though
you create an instance of, say, a Timer, there seems to be a global
mechanism behind it that will hold a ref to the handler's instance, even
when the timer instance goes out of scope (IMO, that should be handled by
the player properly instead of being presented as a feature as it usually
is, since it kind of breaks the whole GC model, but I digress).

Cheers
Juan Pablo Califano

2009/4/28 Paul Andrews <p...@ipauland.com>

>
> ----- Original Message ----- From: "Muzak" <p.ginnebe...@telenet.be>
> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> Sent: Tuesday, April 28, 2009 7:46 PM
> Subject: Re: [Flashcoders] Memory concerns
>
>
>   If you have many listeners in a loaded external movie and then you
>>>> remove
>>>> the movie are the listeners still in memory, which might cause problems
>>>> later?
>>>>
>>>
>>> Yes.
>>>
>>>
>> AFAIK, that's a "No". If there are no more references *to* the external
>> movie, you should be fine.
>>
>
> I'm not sure that's true for Loader.unload() and event handlers..
>
> There are problems however with external movies having NetConnection,
>> NetStream and Sound objects.
>> For that, a new method was introduced:
>>
>
> Interestingly enough this method explicitly deals with event dispatchers
> and is only available in FP10.
>
> So, you may be right but I'm not entirely convined about unload() sorting
> out event handlers.
>
> Paul
>
>
> Loader.unloadAndStop();
>>
>> Have a look at Loader.unload() and loader.unloadAndStop()
>>
>>
>> http://livedocs.adobe.com/flex/3/langref/flash/display/Loader.html#unload()
>>
>> http://livedocs.adobe.com/flex/3/langref/flash/display/Loader.html#unloadAndStop()
>>
>>
>> ----- Original Message ----- From: "Paul Andrews" <p...@ipauland.com>
>> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
>> Sent: Tuesday, April 28, 2009 7:55 PM
>> Subject: Re: [Flashcoders] Memory concerns
>>
>>
>> ----- Original Message ----- From: "John R. Sweeney Jr" <
>>> jr.swee...@comcast.net>
>>> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
>>> Sent: Tuesday, April 28, 2009 6:35 PM
>>> Subject: [Flashcoders] Memory concerns
>>>
>>>
>>> I know you have to implicitly remove objects to free up memory, but does
>>>> that also apply to listeners?
>>>>
>>>
>>> Yes.
>>>
>>>
>>>> If you have many listeners in a loaded external movie and then you
>>>> remove
>>>> the movie are the listeners still in memory, which might cause problems
>>>> later?
>>>>
>>>
>>> Yes.
>>>
>>> Thanks in advance for any insights,
>>>> John
>>>>
>>>
>>> Anything with a reference to it won't be garbage collected and that
>>> includes listeners and instances referenced by listeners (unless it's a weak
>>> reference).
>>>
>>> Paul
>>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to